Skip to content Skip to sidebar Skip to footer

Imgurpython.helpers.error.imgurclientratelimiterror: Rate-limit Exceeded

I have the following error: /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. Th

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.

https://api.imgur.com/#limits

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"