def __init__(self):
# store the url of homepage, traffic page, the country code, and the state code
self.home_url = "http://infotrafego.pbh.gov.br"
self.traffic_url = "http://infotrafego.pbh.gov.br/info_trafego_cameras.html"
self.country = "BR"
self.state = ""
# open the file to store the list and write the format of the list at the first line
self.list_file = open("list_infotrafego_traffic.txt", "w")
self.list_file.write("city#country#snapshot_url#latitude#longitude" + "\n")
# get the webdriver of the opened firefox and open the url
firefox_profile = webdriver.FirefoxProfile()
firefox_profile.set_preference("browser.download.folderList", 2)
firefox_profile.set_preference("javascript.enabled", False)
self.driver = webdriver.Firefox(firefox_profile=firefox_profile)
# gps module
self.gps = Geocoding('Google', None)
reload(sys)
sys.setdefaultencoding('utf8')
Brazil_infotrafego_traffic.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录