人数 API - QUOTA_EXCEEDED / 超出 FBS 配额限制
People API - QUOTA_EXCEEDED / FBS quota limit exceeded
google 人员 api 页面正确说明了如何验证和列出 10 个示例联系人,一切都完美无缺:
https://developers.google.com/people/quickstart/python
我可以完美地验证并列出 10 个,但我在尝试创建新联系人时遇到错误。
api 返回以下错误:
HttpError: <HttpError 429 when requesting https://people.googleapis.com/v1/people:createContact?alt=json returned "Resource has been exhausted (e.g. check quota).". Details: "[{'@type': 'type.googleapis.com/google.rpc.QuotaFailure', 'violations': [{'subject': 'QUOTA_EXCEEDED', 'description': 'FBS quota limit exceeded.'}]}]">
当我点击 https://people.googleapis.com/v1/people:createContact?alt=json 时,页面上有以下 json:
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"
}
}
我完美地改变了范围,甚至在几个月前创建了联系人。
突然间一切都停止了工作,我遇到了麻烦 QUOTA_EXCEEDED 和 FBS 配额限制超出了
我重做了整个身份验证过程,甚至尝试列出联系人,没有问题,一切都完美 少了联系人的创建
一些观察:
- 我通过 jupyter notebook 使用,我也登录了电子邮件
我想创建联系人
- 我已经尝试 运行 IDE 和同样的问题
- 我已经通过这种方式创建了 26888 个联系人
- 这个项目没有出现在 Google 控制台上,因为我想我
通过文档页面做了整个项目,我相信配额并没有用完,只是因为我可以正确地看到这些值。我平均每 3 秒创建 1 个联系人,每天创建 200 个联系人(最多)
我需要很多帮助来了解为什么我无法创建更多联系人,因此我有很多待处理的工作,谢谢。
我创建联系人的代码:
def main():
creds = None
# The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
'credentials.json', SCOPES)
creds = flow.run_local_server(port=0)
# Save the credentials for the next run
with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)
service = build('people', 'v1', credentials=creds)
#----------------creatingc contacts----------------------
print('trying')
for i in df_banco_linhas[:2]:
if i[1] not in df_csv_linhas:
time.sleep(3)
service.people().createContact( body={
"names": [
{
"givenName": i[0]
}
],
"phoneNumbers": [
{
'value': i[1]
}
]
}).execute()
print('create: ' + i[0])
time.sleep(3)
else:
print('NO')
if __name__ == '__main__':
main()
由于问题仅在创建联系人时发生,我决定调查联系人数量的限制,并在文档中发现了 25000 的限制。
我被迫创建另一封电子邮件来解决问题并将我的容量增加到 50000 个联系人(同步两封电子邮件)。
他们的错误消息表示问题出在配额限制(请求)中,而实际上是电子邮件联系人的限制。
出于不同的原因,我收到了同样的超出配额限制的错误(“超出 FBS 配额限制。”)。我为 Organization.jobDescription 字段提供的值太长了。
当某些 non-rate 约束被违反时,例如电子邮件总数或字段的最大长度,可能会触发此特定配额限制。
这可能不是故意的,因为这种违规行为不符合 429 状态代码,并且该限制未列在控制台中人员 API 的 Quotas section of the API/Service Details page 中。
google 人员 api 页面正确说明了如何验证和列出 10 个示例联系人,一切都完美无缺:
https://developers.google.com/people/quickstart/python
我可以完美地验证并列出 10 个,但我在尝试创建新联系人时遇到错误。
api 返回以下错误:
HttpError: <HttpError 429 when requesting https://people.googleapis.com/v1/people:createContact?alt=json returned "Resource has been exhausted (e.g. check quota).". Details: "[{'@type': 'type.googleapis.com/google.rpc.QuotaFailure', 'violations': [{'subject': 'QUOTA_EXCEEDED', 'description': 'FBS quota limit exceeded.'}]}]">
当我点击 https://people.googleapis.com/v1/people:createContact?alt=json 时,页面上有以下 json:
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"
}
}
我完美地改变了范围,甚至在几个月前创建了联系人。 突然间一切都停止了工作,我遇到了麻烦 QUOTA_EXCEEDED 和 FBS 配额限制超出了
我重做了整个身份验证过程,甚至尝试列出联系人,没有问题,一切都完美 少了联系人的创建
一些观察:
- 我通过 jupyter notebook 使用,我也登录了电子邮件 我想创建联系人
- 我已经尝试 运行 IDE 和同样的问题
- 我已经通过这种方式创建了 26888 个联系人
- 这个项目没有出现在 Google 控制台上,因为我想我 通过文档页面做了整个项目,我相信配额并没有用完,只是因为我可以正确地看到这些值。我平均每 3 秒创建 1 个联系人,每天创建 200 个联系人(最多)
我需要很多帮助来了解为什么我无法创建更多联系人,因此我有很多待处理的工作,谢谢。
我创建联系人的代码:
def main():
creds = None
# The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
'credentials.json', SCOPES)
creds = flow.run_local_server(port=0)
# Save the credentials for the next run
with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)
service = build('people', 'v1', credentials=creds)
#----------------creatingc contacts----------------------
print('trying')
for i in df_banco_linhas[:2]:
if i[1] not in df_csv_linhas:
time.sleep(3)
service.people().createContact( body={
"names": [
{
"givenName": i[0]
}
],
"phoneNumbers": [
{
'value': i[1]
}
]
}).execute()
print('create: ' + i[0])
time.sleep(3)
else:
print('NO')
if __name__ == '__main__':
main()
由于问题仅在创建联系人时发生,我决定调查联系人数量的限制,并在文档中发现了 25000 的限制。
我被迫创建另一封电子邮件来解决问题并将我的容量增加到 50000 个联系人(同步两封电子邮件)。
他们的错误消息表示问题出在配额限制(请求)中,而实际上是电子邮件联系人的限制。
出于不同的原因,我收到了同样的超出配额限制的错误(“超出 FBS 配额限制。”)。我为 Organization.jobDescription 字段提供的值太长了。
当某些 non-rate 约束被违反时,例如电子邮件总数或字段的最大长度,可能会触发此特定配额限制。
这可能不是故意的,因为这种违规行为不符合 429 状态代码,并且该限制未列在控制台中人员 API 的 Quotas section of the API/Service Details page 中。