Google 翻译 API V2 的速率限制是多少?

发布于 2024-12-08 03:44:56 字数 617 浏览 3 评论 0原文

我非常频繁地使用 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 技术交流群。

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

发布评论

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

评论(2

橘味果▽酱 2024-12-15 03:44:56

我终于发现了,所以我会回答我自己的问题。
可以在 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.

渔村楼浪 2024-12-15 03:44:56

每当超出配额时,就会返回 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).

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