问题
I am using the Google translate API V2 very intensely and after about 2000 requests I start getting this in the returning JSON:
Array
(
[error] => Array
(
[errors] => Array
(
[0] => Array
(
[domain] => usageLimits
[reason] => userRateLimitExceeded
[message] => User Rate Limit Exceeded
)
)
[code] => 403
[message] => User Rate Limit Exceeded
)
)
Any idea what the rate limit is? and do you have a smart way of regulating the requests rate?
回答1:
I finally found out so I will answer my own question. The rate limit for the API can be set at the admin panel for your API's (https://code.google.com/apis/console) under the quotas section in the left hand menu. I did not find a full documentation of the possible errors that can be returned by an API.
回答2:
HTTP status 403 is returned whenever the quota is exceeded.
Remark I've been playing around with very low quotas to test whether this really works as expected. It seems that the quota settings are not applied immediately, since it took some time (~10-20 minutes) until the API finally stopped working (and returned the mentioned error code).
来源:https://stackoverflow.com/questions/7646112/what-is-the-rate-limit-for-google-translate-api-v2