Open
Description
Describe the Bug
When I was using submit_image
, praw encountered a 500 internal server error.
I have a handler for praw.exceptions.RedditAPIException
, but that did not get caught because a requests.exceptions.HTTPError
was raised instead of a praw.exceptions.RedditAPIException
.
I assume that the intent is to have praw except exceptions from "requests" and raise them as praw exceptions (to avoid clients depending on knowledge of internal design).
$ python3 -m pip freeze | grep -e requests -e praw
praw==7.5.0
prawcore==2.3.0
requests==2.26.0
requests-file==1.4.3
requests-oauthlib==1.3.0
requests-toolbelt==0.9.1
requests-unixsocket==0.2.0
Desired Result
praw should have raised a praw.exceptions.RedditAPIException
(or one of the classes that inherit from that)
Relevant Logs
File "/home/rolf/weather/redditSend.py", line 160, in postImage
submission = sub.submit_image(
File "/home/rolf/.local/lib/python3.8/site-packages/praw/models/reddit/subreddit.py", line 1188, in submit_image
"title": title,
File "/home/rolf/.local/lib/python3.8/site-packages/praw/models/reddit/subreddit.py", line 701, in _upload_media
response.raise_for_status()
File "/home/rolf/.local/lib/python3.8/site-packages/requests/models.py", line 953, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://reddit-uploaded-media.s3-accelerate.amazonaws.com/
Code to reproduce the bug
# I don't have a reproduction because in requires reddit to send back a 500.
My code example does not include the Reddit()
initialization to prevent credential leakage.
Yes
This code has previously worked as intended.
No
Operating System/Environment
Linux Mint 20.2 Cinnamon
Python Version
Python 3.8.10
PRAW Version
7.5.0
Prawcore Version
2.3.0
Anything else?
No response