检查是否达到 YQL 限制?

发布于 2024-08-31 20:52:41 字数 174 浏览 3 评论 0原文

有什么方法(除了必须添加自定义代码之外)来检查我的应用程序是否超出了允许的 YQL 限制? (不确定每个应用程序限制或每个 IP 限制是否适用于我的情况)我假设达到限制后所有查询都会失败,但我想主动添加措施来防止这种情况发生。

我在应用程序的关键部分使用 YQL,并且由于每隔几秒发出一次查询,我怀疑我可能已接近极限。

Is there any way (other than having to add custom code) to check if my application has exceeded the YQL limits that are allowed? (Not sure if per application limit or the per IP limit applies in my case) I assume that all queries would fail after the limit is reached, but I'd like to be proactive in adding measures to prevent this from happening.

I am using YQL in a critical piece in the application and since a query is issued every few seconds, I suspect I might be nearing the limit.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

澜川若宁 2024-09-07 20:52:41

不幸的是,在其他情况下也会返回错误代码 999,因此它不是达到每小时 10k 限制的可靠指标。

来自 Yahoo/YQL 的响应示例:

HTTP/1.1 999 Unable to process request at this time -- error 999
Date: Sun, 07 Nov 2010 13:46:10 GMT
Expires: Thu, 01 Jan 1970 22:00:00 GMT
Cache-Control: no-cache, private
Cache-Control: no-store
Pragma: no-cache
Vary: Accept-Encoding
Content-Type: text/html;charset=UTF-8
Age: 0
Transfer-Encoding: chunked
Connection: keep-alive
Server: YTS/1.17.21

我认为,如果 YQL 能够像 Twitter 那样返回一个包含每小时剩余 YQL 调用的标头字段,那就太好了。

Twitter API 的 HTTP 响应标头的相关部分:

HTTP/1.1 200 OK
Date: Sun, 07 Nov 2010 13:52:18 GMT
X-RateLimit-Limit: 150
X-RateLimit-Remaining: 147
X-RateLimit-Class: api
X-Revision: DEV
X-RateLimit-Reset: 1289141505

Unfortunately error code 999 is also returned in other situations, so it is not a reliable indicator of reaching the hourly 10k limit.

Example of response from Yahoo/YQL:

HTTP/1.1 999 Unable to process request at this time -- error 999
Date: Sun, 07 Nov 2010 13:46:10 GMT
Expires: Thu, 01 Jan 1970 22:00:00 GMT
Cache-Control: no-cache, private
Cache-Control: no-store
Pragma: no-cache
Vary: Accept-Encoding
Content-Type: text/html;charset=UTF-8
Age: 0
Transfer-Encoding: chunked
Connection: keep-alive
Server: YTS/1.17.21

I think it would be great if YQL could return a header field with the remaining YQL calls for per hour, like Twitter does.

Relevant parts of the HTTP Response Header of the Twitter API:

HTTP/1.1 200 OK
Date: Sun, 07 Nov 2010 13:52:18 GMT
X-RateLimit-Limit: 150
X-RateLimit-Remaining: 147
X-RateLimit-Class: api
X-Revision: DEV
X-RateLimit-Reset: 1289141505
素衣风尘叹 2024-09-07 20:52:41

如果您超过每小时 10k 次点击的限额,您将收到代码 999 的错误 - 相应地编写代码以避免被阻止。

If you exceed the hourly allowance of 10k hits you will get back an error with the code 999 - write your code accordingly to avoid being blocked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文