#testing retreivable images

import requests
from time import time

headerz = { 'Referer' :
	'https://www.portvancouver.com/' }

milliseconds = int(time() * 1000)

while True:
	x = requests.get("https://ehub.portvancouver.com/Webcams/Photos/PortsideNo8?" + str(milliseconds), headers=headerz)
	image_name = "image" + str(milliseconds) + ".jpg"
	milliseconds -= 20000

	if x.status_code == 200:
		with open(image_name, 'wb') as f:
			f.write(x.content)
	print(x.status_code)
