Google 翻译 API v2 - 显示 403 'Daily Limit Exceeded' 错误

Google translate API v2 - Showing 403 'Daily Limit Exceeded' error

我想把日文翻译成英文。 但是下面的代码没有给出任何结果。我尝试使用不同 api_key 的不同帐户。 代码是这样的:

from apiclient.discovery import build

API_KEY = '...'

print build(
    'translate', 'v2', developerKey=API_KEY,
).translations().list(
    q=u'こんにちは', source='ja', target='en',
).execute()

显示以下错误消息:

googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/language/translate/v2?q=%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF&source=ja&alt=json&target=en&key=API_KEY returned "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/translate/quotas?project=906333222111">

我启用了翻译api。但是我没有对 计费帐户 做任何事情。我觉得没必要(Google Translate API has default limits of 2 million characters/day and 10,000 characters per 100 seconds (average 100 characters/second)).

他们还在计费部分检查域使用情况。

Daily Limit Exceeded

表示您已经超出了每天允许的 API 请求数量。在太平洋时间 (PT) 午夜之前,您不能再向 API 发出任何请求。

回答:没有免费的Google翻译API您需要启用计费。常见问题解答:Is there a free quota.

Is there any free quota?
No, the Google Translate API is only available as a paid service. Please see Pricing and Support for more details. However we do offer the Google Website Translator gadget, which will translate your website without charge.

要为您的项目启用计费,请执行以下操作:

  1. 转到项目设置页面。如果出现提示,select 一个项目或创建一个新项目。
  2. 在“计费”部分,单击“启用计费”。
  3. 如果您没有结算帐户,请创建一个。
  4. Select 您的位置,填写表格,然后单击提交并启用计费。

定价文档:Pricing

Important: Google Translate API v2 requires billing information for all accounts before you can start using the service. See instructions below on how to enable billing.