Closed grantmcconnaughey closed 9 months ago
They might be blocking image uploads. It could also be a service outage. We'll have to wait and see.
I have same issue.
Still ongoing as of 13:54
UTC.
Could you try updating to this version and see if it resolves the issue?
pip install --upgrade https://github.com/praw-dev/praw/archive/LilSpazJoekp-patch-1.zip
Could you try updating to this version and see if it resolves the issue?
pip install --upgrade https://github.com/praw-dev/praw/archive/LilSpazJoekp-patch-1.zip
I got this error after update. Error while posting image to subreddit: received 403 HTTP response
Hmm I have to do some more checking. Did you check if a post was actually made? Also did it print a stack trace?
No post has not been created, It just returned " received 403 HTTP response"
Doesn't resolve the issue for me either see below
self.request( File "/home/user/.local/lib/python3.10/site-packages/praw/util/deprecate_args.py", line 43, in wrapped return func(**dict(zip(_old_args, args)), **kwargs) File "/home/user/.local/lib/python3.10/site-packages/praw/reddit.py", line 941, in request return self._core.request( File "/home/user/.local/lib/python3.10/site-packages/prawcore/sessions.py", line 330, in request return self._request_with_retries( File "/home/user/.local/lib/python3.10/site-packages/prawcore/sessions.py", line 266, in _request_with_retries raise self.STATUS_EXCEPTIONS[response.status_code](response) prawcore.exceptions.Forbidden: received 403 HTTP response
This Reddit post seems to think this is happening because the websocket URL has moved: https://www.reddit.com/r/redditdev/comments/16wfw86/apisubmit_upload_websocket_fix/
Yep, working on a fix for that right now!
Awesome, thank you so much!
Yep, working on a fix for that right now!
Thank you !
Got a fix ready. Can someone test to confirm? It worked for me when writing tests but want to make sure it works for y'all.
pip install --upgrade https://github.com/praw-dev/praw/archive/fix-image-uploads.zip
Got a fix ready. Can someone test to confirm? It worked for me when writing tests but want to make sure it works for y'all.
pip install --upgrade https://github.com/praw-dev/praw/archive/fix-image-uploads.zip
I tried to test it but get 403 error again. Full Traceback:
Traceback (most recent call last):
File "x\reddit_bot.py", line 32, in submit_to_subreddit
submission = subreddit.submit_image(title=title, image_path=image_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "x\env\Lib\site-packages\praw\util\deprecate_args.py", line 45, in wrapped
return func(**dict(zip(_old_args, args)), **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "x\env\Lib\site-packages\praw\models\reddit\subreddit.py", line 1508, in submit_image
image_url, websocket_url = self._upload_media(
^^^^^^^^^^^^^^^^^^^
File "x\env\Lib\site-packages\praw\models\reddit\subreddit.py", line 965, in _upload_media
upload_response = self._reddit.post(url, data=img_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "x\env\Lib\site-packages\praw\util\deprecate_args.py", line 45, in wrapped
return func(**dict(zip(_old_args, args)), **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "x\env\Lib\site-packages\praw\reddit.py", line 838, in post
return self._objectify_request(
^^^^^^^^^^^^^^^^^^^^^^^^
File "x\env\Lib\site-packages\praw\reddit.py", line 513, in _objectify_request
self.request(
File "x\env\Lib\site-packages\praw\util\deprecate_args.py", line 45, in wrapped
return func(**dict(zip(_old_args, args)), **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "x\env\Lib\site-packages\praw\reddit.py", line 939, in request
return self._core.request(
^^^^^^^^^^^^^^^^^^^
File "x\env\Lib\site-packages\prawcore\sessions.py", line 330, in request
return self._request_with_retries(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "xt\env\Lib\site-packages\prawcore\sessions.py", line 266, in _request_with_retries
raise self.STATUS_EXCEPTIONS[response.status_code](response)
prawcore.exceptions.Forbidden: received 403 HTTP response
Got a fix ready. Can someone test to confirm? It worked for me when writing tests but want to make sure it works for y'all.
pip install --upgrade https://github.com/praw-dev/praw/archive/fix-image-uploads.zip
I tried to test it but get 403 error again. Full Traceback:
Traceback (most recent call last): File "C:\Users\MSI\PycharmProjects\django-amazon-bot\products\tools\reddit_bot.py", line 32, in submit_to_subreddit submission = subreddit.submit_image(title=title, image_path=image_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\util\deprecate_args.py", line 45, in wrapped return func(**dict(zip(_old_args, args)), **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\models\reddit\subreddit.py", line 1508, in submit_image image_url, websocket_url = self._upload_media( ^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\models\reddit\subreddit.py", line 965, in _upload_media upload_response = self._reddit.post(url, data=img_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\util\deprecate_args.py", line 45, in wrapped return func(**dict(zip(_old_args, args)), **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\reddit.py", line 838, in post return self._objectify_request( ^^^^^^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\reddit.py", line 513, in _objectify_request self.request( File "x\env\Lib\site-packages\praw\util\deprecate_args.py", line 45, in wrapped return func(**dict(zip(_old_args, args)), **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "x\django-amazon-bot\env\Lib\site-packages\praw\reddit.py", line 939, in request return self._core.request( ^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\prawcore\sessions.py", line 330, in request return self._request_with_retries( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "xt\env\Lib\site-packages\prawcore\sessions.py", line 266, in _request_with_retries raise self.STATUS_EXCEPTIONS[response.status_code](response) prawcore.exceptions.Forbidden: received 403 HTTP response
This stacktrace does not match the code in the branch. More specifically image_url, websocket_url = self._upload_media(
doesn't exist anymore.
Got a fix ready. Can someone test to confirm? It worked for me when writing tests but want to make sure it works for y'all.
pip install --upgrade https://github.com/praw-dev/praw/archive/fix-image-uploads.zip
I tried to test it but get 403 error again. Full Traceback:
Traceback (most recent call last): File "C:\Users\MSI\PycharmProjects\django-amazon-bot\products\tools\reddit_bot.py", line 32, in submit_to_subreddit submission = subreddit.submit_image(title=title, image_path=image_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\util\deprecate_args.py", line 45, in wrapped return func(**dict(zip(_old_args, args)), **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\models\reddit\subreddit.py", line 1508, in submit_image image_url, websocket_url = self._upload_media( ^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\models\reddit\subreddit.py", line 965, in _upload_media upload_response = self._reddit.post(url, data=img_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\util\deprecate_args.py", line 45, in wrapped return func(**dict(zip(_old_args, args)), **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\reddit.py", line 838, in post return self._objectify_request( ^^^^^^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\praw\reddit.py", line 513, in _objectify_request self.request( File "x\env\Lib\site-packages\praw\util\deprecate_args.py", line 45, in wrapped return func(**dict(zip(_old_args, args)), **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "x\django-amazon-bot\env\Lib\site-packages\praw\reddit.py", line 939, in request return self._core.request( ^^^^^^^^^^^^^^^^^^^ File "x\env\Lib\site-packages\prawcore\sessions.py", line 330, in request return self._request_with_retries( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "xt\env\Lib\site-packages\prawcore\sessions.py", line 266, in _request_with_retries raise self.STATUS_EXCEPTIONS[response.status_code](response) prawcore.exceptions.Forbidden: received 403 HTTP response
This stacktrace does not match the code in the branch. More specifically
image_url, websocket_url = self._upload_media(
doesn't exist anymore.
I did a clean install from scratch. It worked perfectly ! PS: On my first run, I got the error "websocket error occurred, it may still have been created, please check", but on my second run, it succeeded without entering the except block.
Thank you for addressing this so quickly. I can confirm the linked package solved my issue as well!
Likewise can confirm, branch fix-image-uploads
indeed fixes image uploads!
@LilSpazJoekp I'm just letting you know for informational purposes, sometimes it gives a websocket error consecutively. It loads the image, but when I try to reply to the related submission, it returns a NoneType.
@LilSpazJoekp I'm just letting you know for informational purposes, sometimes it gives a websocket error consecutively. It loads the image, but when I try to reply to the related submission, it returns a NoneType.
What does it look like on Reddit?
@LilSpazJoekp I'm just letting you know for informational purposes, sometimes it gives a websocket error consecutively. It loads the image, but when I try to reply to the related submission, it returns a NoneType.
What does it look like on Reddit?
It creates the post with the image, but it can't reply because submission returns a NoneType.
submission = subreddit.submit_image(title=title, image_path=image_path)
if submission:
self.reply_to_submission(submission, text)
*This happens when websocket gives error.
Gotcha. Then I'll need to do some more changes to it.
just to clarify, you are saying that PRAW can't send replies backend - but on the website frontend, one would still be able to, correct?
Because I have been able to do the latter
@LilSpazJoekp Hello, any update with this situation ?
Currently looking but so far it seems that if the websocket fails or you tell PRAW to not use websockets, PRAW won't be able to return a submission object because there isn't anything in the responses that returns the new submission ID.
Currently looking but so far it seems that if the websocket fails or you tell PRAW to not use websockets, PRAW won't be able to return a submission object because there isn't anything in the responses that returns the new submission ID.
As far as I know that's how it has always worked before.
For what it's worth I've deployed your fix for the last week or two and it's been working great. Or at least working the same as before Reddit broke the URL.
There is still an issue where nothing is returned if you submit without websockets. This is documented. Plus if websockets fail the yes, naturally there isn't anything we can do in PRAW other than retry, I guess.
Gotcha. Then there isn't much PRAW can do if it doesn't to connect to the web socket. I'll get the fix merged in soon.
Describe the Bug
Starting about 33 minutes ago the Praw
submit_image
andsubmit_video
methods began failing with the error messageConnectionRefusedError: [Errno 111] Connection refused
when submitting image and video posts using websockets.without_websockets=True
does seem to work, but notably does not return a submission object, which means callers do not receive the newly created submission or submission ID.I'm not sure if this is an intentional change by Reddit or not, as this is an undocumented API and they likely won't announce changes to it either way.
Desired Result
Image and video posts should submit with websockets.
Code to reproduce the bug
The
Reddit()
initialization in my code example does not include the following parameters to prevent credential leakage:client_secret
,password
, orrefresh_token
.Relevant Logs
This code has previously worked as intended.
Yes
Operating System/Environment
Linux
Python Version
3.11
PRAW Version
7.6.0
Prawcore Version
2.3.0
Anything else?
No response