Created
February 15, 2019 16:05
-
-
Save awave1/0c428b0040bd0897b3bd6c551235436e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import datetime | |
import os | |
if not os.path.exists('images/'): | |
os.makedirs('images/') | |
def dl_jpg(url, file_path, file_name): | |
full_path = file_path + file_name + '.jpg' | |
urllib.request.urlretrieve(url,full_path) | |
currentDT = datetime.datetime.now() | |
for x in range(116): | |
if x not in [9, 106, 107, 109, 110, 112]: | |
url = 'http://trafficcam.calgary.ca/loc' + str(x) + '.jpg' | |
file_name = "log" + str(x) + 'm' + str(currentDT.month) + 'd'+ str(currentDT.day) + 'h'+ str(currentDT.hour) + 'm'+ str(currentDT.minute) | |
print(url) | |
print(file_name) | |
dl_jpg(url, 'images/', file_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment