Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if YQL limits have been reached?

Tags:

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.

like image 815
Nick Avatar asked May 10 '10 21:05

Nick


2 Answers

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
like image 133
spier Avatar answered Nov 04 '22 13:11

spier


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.

like image 3
Chris Heilmann Avatar answered Nov 04 '22 12:11

Chris Heilmann