import urllib import os import datetime if __name__ __main__ url_file

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import urllib
import os
import datetime
if __name__ == "__main__":
url_file = "http://www.luisespinosa.com/trackme/routes/gigimon.kml"
save_path = os.getcwd() + "\\routes\\" + datetime.datetime.now().strftime("%d-%m-%y")
proxy = {"http":"http://192.168.112.254:8080"}
try:
file_inet = urllib.urlopen(url_file,proxies=proxy)
except IOError:
print "Not open file"
os.mkdir(os.getcwd() + "\\routes\\" + datetime.datetime.now().strftime("%d-%m-%y"))
file_save = file("%s\\torg1.kml"%save_path,"w+")
file_save.writelines(file_inet.readlines())
file_save.close()