Store the downloaded images only if status_code == 200

This commit is contained in:
Takeshi KOMIYA
2017-04-22 09:25:41 +09:00
parent 806dff0e94
commit 3aef91764d

View File

@@ -84,8 +84,9 @@ class ImageDownloader(BaseImageConverter):
else:
self.app.env.original_image_uri[path] = node['uri']
with open(path, 'wb') as f:
f.write(r.content)
if r.status_code == 200:
with open(path, 'wb') as f:
f.write(r.content)
last_modified = r.headers.get('last-modified')
if last_modified: