Files
PortCameras/testing.txt

32 lines
941 B
Plaintext

import requests
from time import time
from time import sleep
from contextlib import chdir
import copy
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/' }
milliseconds = int(time() * 1000)
image_check = requests.get("https://ehub.portvancouver.com/Photos/CPCTruckRoute?" + str(milliseconds))
print(image_check)
while True:
milliseconds = int(time() * 1000)
str1 = "https://ehub.portvancouver.com/Photos/CPCTruckRoute?" + str(milliseconds)
image_name = "image" + str(milliseconds) + ".jpg"
x1 = requests.get(str1, headers=headerz)
if x1.content != image_check.content:
if x1.status_code == 200:
with open(image_name, 'wb') as f:
f.write(x1.content)
else:
print("Copy detected and removed (x1)")
image_check = copy.deepcopy(x1)