Open YuviGold opened 3 days ago
The references you linked are for operations that have additional rate limits. It has nothing to do with general rate limiting that is dictated by the rate limit headers that Reddit returns.
The issue here is you're operating PRAW with a thread pool executor and PRAW is not thread safe. This is causing all the requests to fire off all at once instead of respecting the rate limit. You're also fetching a post that is already fetched from a listing and as a result, you're consuming all of your API requests.
The references you linked are for operations that have additional rate limits. It has nothing to do with general rate limiting that is dictated by the rate limit headers that Reddit returns.
The issue here is you're operating PRAW with a thread pool executor and PRAW is not thread safe. This is causing all the requests to fire off all at once instead of respecting the rate limit. You're also fetching a post that is already fetched from a listing and as a result, you're consuming all of your API requests.
Thanks @LilSpazJoekp
The example above was only to demonstrate an explicit scenario of many requests. But yes - in my use-case I have multiple processes trying to parse different posts/comments from Reddit that under-the-hood call fetch and I hit prawcore.exceptions.TooManyRequests: received 429 HTTP response
.
I noticed the confusion of the docs was already brought up in https://github.com/praw-dev/praw/issues/1777. Maybe what's missing for me - if there are ratelimit cases uncovered by PRAW - what can be done to handle them? Could you help me understand how should it be treated? How long does it take for my API requests consumption to refresh?
if there are ratelimit cases uncovered by PRAW - what can be done to handle them?
The cases that get uncovered are the ones referenced in the docs you linked. You'll just need to specify how long you want PRAW to wait when it hits one of those rate limits with the ratelimit_seconds
configuration parameter. In you receive a 429 error than that could mean you're running too many instances of PRAW.
How long does it take for my API requests consumption to refresh?
10 minutes.
Describe the Bug
When running a lot of operations including fetch, a rate limit exception would be raised.
Desired Result
Following
there is an internal rate limit handling (docs) - but only for POST operations. The same should
Code to reproduce the bug
My code does not include sensitive credentials
Relevant Logs
This code has previously worked as intended
No
Operating System/Environment
macOS
Python Version
3.11.6
PRAW Version
7.7.1
Links, references, and/or additional comments?
No response