Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Check http response #100

Merged
merged 1 commit into from
Jan 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
}
# 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()

Check warning on line 153 in src/iembot/util.py

View check run for this annotation

Codecov / codecov/patch

src/iembot/util.py#L152-L153

Added lines #L152 - L153 were not covered by tests
# 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")

Check warning on line 155 in src/iembot/util.py

View check run for this annotation

Codecov / codecov/patch

src/iembot/util.py#L155

Added line #L155 was not covered by tests
params["media_ids"] = [media_id]
res = api.status_post(**params)
except mastodon.errors.MastodonRatelimitError as exp:
Expand Down
Loading