Imgur API - Getting “Too many Request” error even though 'X-Ratelimit-Userremaining' is not 0

ε祈祈猫儿з 提交于 2021-01-28 12:11:42

问题


I am uploading images through the Imgur API (https://apidocs.imgur.com/) but I am getting a 'Too many Request' (err 429) even thought the previous request returned 'X-Ratelimit-Userremaining=1216'. My understanding is that I should be able to do 1216 POST before hitting the rate limit.

Edit:

First request header (success)

X-Ratelimit-Userlimit ,Value : [2000]
X-Post-Rate-Limit-Reset ,Value : [1099]
X-Ratelimit-Clientreset ,Value : [11017]
X-Ratelimit-Userreset ,Value : [3600]
X-Ratelimit-Userremaining ,Value : [1216]
X-Post-Rate-Limit-Remaining ,Value : [1244]
X-Ratelimit-Clientlimit ,Value : [12500]
X-Post-Rate-Limit-Limit ,Value : [1250]
X-Ratelimit-Clientremaining ,Value : [12248]
Content-Type ,Value : [application/json]

Second request headers (fail, rate limit hit):

X-Ratelimit-Userlimit ,Value : [2000]
X-Ratelimit-Clientreset ,Value : [10204]
X-Ratelimit-Userreset ,Value : [3600]
X-Ratelimit-Userremaining ,Value : [0]
X-Ratelimit-Clientlimit ,Value : [12500]
X-Ratelimit-Clientremaining ,Value : [12035]
Content-Type ,Value : [application/vnd.imgur.v1+json]

回答1:


Please take a look at https://apidocs.imgur.com/#rate-limits where you'll find detailed information about specific API rate limits.

Imgur has multiple rate limits including per application and user IP limits. Even if you have more user request credits, the application can have no more credits available, and that might trigger the rate limit for your requests.

Each response from the Imgur servers contains rate limit headers that will give you more details about the limits you're hitting.

Rate limit headers included in responses (from Imgur API docs):

  • X-RateLimit-UserLimit - Total credits that can be allocated.
  • X-RateLimit-UserRemaining - Total credits available.
  • X-RateLimit-UserReset - Timestamp (unix epoch) for when the credits will be reset.
  • X-RateLimit-ClientLimit - Total credits that can be allocated for the application in a day.
  • X-RateLimit-ClientRemaining - Total credits remaining for the application in a day.


来源:https://stackoverflow.com/questions/55417370/imgur-api-getting-too-many-request-error-even-though-x-ratelimit-userremain

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!