From 99beb89ed03ab5b3d9f6750efa922e6db3d17c18 Mon Sep 17 00:00:00 2001 From: akrherz Date: Wed, 1 Jan 2025 07:21:06 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Check=20http=20response?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/iembot/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/iembot/util.py b/src/iembot/util.py index 7f41cea..12f1639 100644 --- a/src/iembot/util.py +++ b/src/iembot/util.py @@ -149,9 +149,10 @@ def toot(bot, user_id, twttxt, **kwargs): } # If we have media, we have some work to do! if media is not None: - req = requests.get(media, timeout=30, stream=True) + resp = requests.get(media, timeout=30, stream=True) + resp.raise_for_status() # TODO: Is this always image/png? - media_id = api.media_post(req.raw, mime_type="image/png") + media_id = api.media_post(resp.raw, mime_type="image/png") params["media_ids"] = [media_id] res = api.status_post(**params) except mastodon.errors.MastodonRatelimitError as exp: