The website is:
rmgsc.cr.usgs.gov/outgoing/GeoMAC/ActiveFirePerimeters.kml
When I run the code below, a new kml file appears to be saved on my drive, however it does not bring over the entire file. Instead of 154MB, it brings over a file that is only 17 bytes.
I can either go to the website (rmgsc.cr.usgs.gov/outgoing/GeoMAC/) and then click on a link named "ActiveFirePerimeters.kml", or go to the website with the kml file name included which automatically initiates a download. In IE9 I would then need to click a "Save" button, however in Chrome it appears to automatically download. However in both only 17bytes come across....
Here is my code for Internet Explorer:
Expand|Select|Wrap|Line Numbers
- import os, webbrowser
- target_dir = r"C:\DataTest"
- filename = "ActiveFirePerimeters.kml"
- fullname = os.path.join(target_dir,filename)
- with open(fullname,"w") as f:
- f.write("<html>....</html>")
- url = "rmgsc.cr.usgs.gov/outgoing/GeoMAC/ActiveFirePerimeters.kml"
- webbrowser.open(url,True,True)
- os.system("taskkill /F /IM iexplore.exe")