mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Tweak media caching
This commit is contained in:
parent
9a037b132a
commit
abbcebb81d
1 changed files with 0 additions and 2 deletions
|
@ -15,8 +15,6 @@ def load(url, user_agent):
|
|||
"""Initializes a `PIL.Image` from the URL."""
|
||||
with requests.get(url, stream=True, headers={"User-Agent": user_agent}) as resp:
|
||||
resp.raise_for_status()
|
||||
if not resp.headers.get("content-type").startswith("image/"):
|
||||
raise ValueError(f"bad content-type {resp.headers.get('content-type')}")
|
||||
|
||||
resp.raw.decode_content = True
|
||||
return Image.open(BytesIO(resp.raw.read()))
|
||||
|
|
Loading…
Reference in a new issue