Do not throw on MissingSchema request exception, see #120

This commit is contained in:
Lucas Verney 2018-07-16 13:18:42 +02:00
parent 540d69f9e2
commit 4df1f1d2a1
1 changed files with 2 additions and 2 deletions

View File

@ -113,14 +113,14 @@ class ImageCache(MemoryCache):
if os.path.isfile(filepath):
return PIL.Image.open(filepath)
# Otherwise, fetch it
req = requests.get(url)
try:
req = requests.get(url)
req.raise_for_status()
image = PIL.Image.open(BytesIO(req.content))
if self.storage_dir:
image.save(filepath, format=image.format)
return image
except (requests.HTTPError, IOError):
except (requests.HTTPError, requests.exceptions.MissingSchema, IOError):
return None
def __init__(self, max_items=200, storage_dir=None):