Google 翻译 API V2 的速率限制是多少?
我非常频繁地使用 Google 翻译 API V2,在大约 2000 个请求之后,我开始在返回的 JSON 中得到以下信息:
Array
(
[error] => Array
(
[errors] => Array
(
[0] => Array
(
[domain] => usageLimits
[reason] => userRateLimitExceeded
[message] => User Rate Limit Exceeded
)
)
[code] => 403
[message] => User Rate Limit Exceeded
)
)
知道速率限制是多少吗?你有一个聪明的方法来调节请求率吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我终于发现了,所以我会回答我自己的问题。
可以在 API 的管理面板中设置 API 的速率限制 (https://code.google. com/apis/console)位于左侧菜单的配额部分下。
我没有找到 API 可能返回的错误的完整文档。
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.
每当超出配额时,就会返回 HTTP 状态 403。
评论
我一直在尝试使用非常低的配额来测试这是否真的按预期工作。配额设置似乎并未立即应用,因为 API 最终停止工作(并返回上述错误代码)需要一些时间(约 10-20 分钟)。
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).