move inside the with block

This commit is contained in:
Stefal 2023-09-16 15:09:17 +02:00
parent e3140c607a
commit 396570ff46

View File

@ -37,9 +37,9 @@ def background(f):
#@background
def download(url, filepath, metadata=None):
with open(str(filepath), "wb") as f:
r = session.get(url, stream=True, timeout=6)
image = write_exif(r.content, metadata)
with open(str(filepath), "wb") as f:
f.write(image)
print("{} downloaded".format(filepath))