Skip to content

Commit

Permalink
Merge pull request #100 from akrherz/relay_non_200
Browse files Browse the repository at this point in the history
πŸ› Check http response
  • Loading branch information
akrherz authored Jan 1, 2025
2 parents e73c868 + 99beb89 commit 191c643
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/iembot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 191c643

Please sign in to comment.