import requests
from time import time
from time import sleep

headerz = {'Accept' : 'image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5', 'Accept-Encoding' :
	'gzip, deflate, br, zstd', 'Accept-Language' :
	'en-CA,en-US;q=0.9,en;q=0.8', 'Referer' :
	'https://www.portvancouver.com/' }

while True:

	seconds = int(time()* 1000)
	print(seconds)
	r = "https://ehub.portvancouver.com/Webcams/Photos/CPCTruckRoute?" + str(time)
	response = requests.get(r, headers=headerz)
	sleep(1)
	image_name = "image" + str(seconds) + ".jpg"
	if response.status_code == 200:
		with open(image_name, 'wb') as f:
			f.write(response.content)
	print(response.status_code)


