You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, getting this error and not sure how to interpret it. The whole purpose of using ratelimit is to prevent too many calls?
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/ratelimit/decorators.py", line 77, in wrapper
raise RateLimitException('too many calls', period_remaining)
ratelimit.exception.RateLimitException: too many calls
I have a simple for loop that calls a function with requests.get in it, which is decorated with @limits(calls=50, period=120) . Would really appreciate some help.
The text was updated successfully, but these errors were encountered:
From the code it seems that the ratelimit decorator does prevent too many calls but it does so by throwing the exception it threw you. This means that you tried to call it more than 50 times in 120 seconds so the decorator threw the error and so prevented you from calling the function too many times.
I would recommend some exception catching or async functions but the decorator itself won't just sit silent and not call your function if you go over the rate limit.
@kingwongf I've found that most of the time I'm wanting to combine the @limits decorator with @sleep_and_retry, so when you hit the rate limit, the thread sleeps until the specified time period has elapsed.
Hi, getting this error and not sure how to interpret it. The whole purpose of using ratelimit is to prevent too many calls?
I have a simple for loop that calls a function with
requests.get
in it, which is decorated with@limits(calls=50, period=120)
. Would really appreciate some help.The text was updated successfully, but these errors were encountered: