mirror of
https://github.com/netzbegruenung/green-spider.git
synced 2024-05-05 10:33:39 +02:00
Add check for local file existence
This commit is contained in:
parent
0286d30151
commit
8375911b06
|
@ -66,9 +66,13 @@ def make_screenshots(url):
|
||||||
]
|
]
|
||||||
subprocess.run(command)
|
subprocess.run(command)
|
||||||
blob = bucket.blob('%s/%s' % (subfolder, filename))
|
blob = bucket.blob('%s/%s' % (subfolder, filename))
|
||||||
with open('./temp/%s/%s' % (subfolder, filename), 'rb') as my_file:
|
local_path = './temp/%s/%s' % (subfolder, filename)
|
||||||
blob.upload_from_file(my_file, content_type="image/png")
|
if os.path.exists(local_path):
|
||||||
blob.make_public()
|
with open(local_path, 'rb') as my_file:
|
||||||
|
blob.upload_from_file(my_file, content_type="image/png")
|
||||||
|
blob.make_public()
|
||||||
|
else:
|
||||||
|
print("Error: No screenshot created: size=%s, url='%s'" % (size, url))
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue