From 396570ff46dab9b4c138448903fad9692050fecc Mon Sep 17 00:00:00 2001 From: Stefal Date: Sat, 16 Sep 2023 15:09:17 +0200 Subject: [PATCH] move inside the with block --- download.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/download.py b/download.py index 38a15d2..71cddc4 100644 --- a/download.py +++ b/download.py @@ -37,9 +37,9 @@ def background(f): #@background def download(url, filepath, metadata=None): - r = session.get(url, stream=True, timeout=6) - image = write_exif(r.content, metadata) with open(str(filepath), "wb") as f: + r = session.get(url, stream=True, timeout=6) + image = write_exif(r.content, metadata) f.write(image) print("{} downloaded".format(filepath))