Raise when status_code is not 200: OK

This commit is contained in:
tcely 2025-05-02 16:12:25 -04:00 committed by GitHub
parent f6b20c03e3
commit 3a0c4c8fb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,6 +65,8 @@ def get_remote_image(url, force_rgb=True):
'(KHTML, like Gecko) Chrome/69.0.3497.64 Safari/537.36')
}
r = requests.get(url, headers=headers, stream=True, timeout=60)
if 200 != r.status_code:
r.raise_for_status()
r.raw.decode_content = True
i = Image.open(r.raw)
if force_rgb: