Imgurpython.helpers.error.imgurclientratelimiterror: Rate-limit Exceeded
Solution 1:
The rate limit refers to how frequently you're hitting the API, not how many calls you're allowed. To prevent hammering, most APIs have a rate limit (eg: 30 requests per minute, 1 every 2 seconds). Your script is making requests as quickly possible, hundreds or even thousands of times faster than the limit.
To prevent your script from hammering, the simplest solution is to introduce a sleep
to your for loop.
from time import sleepfor i in range(10000):
print i
sleep(2) # seconds
Adjust the sleep time to be at least one second greater than what the API defines as its rate limit.
The Imgur API uses a credit allocation system to ensure fair distribution of capacity. Each application can allow approximately 1,250 uploads per day or approximately 12,500 requests per day. If the daily limit is hit five times in a month, then the app will be blocked for the rest of the month. The remaining credit limit will be shown with each requests response in the
X-RateLimit-ClientRemaining
HTTP header.
So 12500 requests / 24 hours is 520 requests per hour or ~8 per minute. That means your sleep should be about 8 seconds long.
Post a Comment for "Imgurpython.helpers.error.imgurclientratelimiterror: Rate-limit Exceeded"