超出 API 配额 [英] API Quota exceeded

查看:36
本文介绍了超出 API 配额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在文档中,我们可以发现限制基于跟踪您每小时发送的请求数量的移动窗口. (https://developer.foursquare.com/overview/ratelimits) 但在实践中,即使我等待几分钟,我的速率限制也不会充电.

In the documentation we can find that The limits are based on a moving window that tracks the number of requests you send per hour. (https://developer.foursquare.com/overview/ratelimits) but in the practice my rate limit isn't recharged even if I wait several minutes.

发生了什么?他们是否更改了 API 速率限制的实施?

What happened? Did they change the implementation of API rate limits?

推荐答案

窗口仍应实时更新.

需要说明的是,如果您的速率限制为 500,则在 11:00,您发送 5 个请求,X-RateLimit-Remaining 将为 495.如果您等待几分钟到 11:05,然后再发送一个请求,剩余的 X-Rate-Limit 将是 494 -- 它尚未重置.

To be clear, if your rate limit is 500, at 11:00, you send 5 requests, the X-RateLimit-Remaining will be 495. If you wait a few minutes to 11:05, and send another request, X-Rate-Limit remaining will be 494 -- it won't have reset yet.

直到 12:01,您才会收到您在 11:00 提出的 5 个请求.因此,如果您在 12:01 再次请求,您的限制将为 498(-1 表示您刚刚执行的请求,-1 表示 11:05 的请求).在 12:06 再次请求,您将回到 499(完全限制,减去您刚刚使用的数量).

It's not until 12:01 that you'll get back the 5 requests that you'd made at 11:00. So, if you request again at 12:01, your limit would be 498 (-1 for the request you just did, -1 for the 11:05 request). Requesting again at 12:06, and you'll be back up to 499 (the full limit, minus what you just used).

这篇关于超出 API 配额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆