Python 3.x &引用;超出配额组的配额';ReadGroup';和限制';每100秒读取每个用户的请求数';谷歌api服务
我试图计算请求api和时间的代码Python 3.x &引用;超出配额组的配额';ReadGroup';和限制';每100秒读取每个用户的请求数';谷歌api服务,python-3.x,google-sheets,google-api,Python 3.x,Google Sheets,Google Api,我试图计算请求api和时间的代码 a =0 count_time = 0 while True: start = time.time() if (sheet.cell(22,9).value) == "#N/A": a = a+1 print("google read request: ",a) time.sleep(1) if (sheet.cell(22,9).value) == "#N/A": a
a =0
count_time = 0
while True:
start = time.time()
if (sheet.cell(22,9).value) == "#N/A":
a = a+1
print("google read request: ",a)
time.sleep(1)
if (sheet.cell(22,9).value) == "#N/A":
a = a+1
print("google read request: ",a)
time.sleep(1)
if (sheet.cell(22,9).value) == "#N/A":
a = a+1
print("google read request: ",a)
time.sleep(1)
success_loop_time = time.time()-start
count_time = count_time + success_loop_time
print("Time: ", round(count_time) , "sec")
最后结果:
Time: 103 sec
google read request: 77
然后这个错误显示出来
raise APIError(response)
gspread.exceptions.APIError: {
"error": {
"code": 429,
"message": "Quota exceeded for quota group 'ReadGroup' and limit 'Read requests per user per 100 seconds' of service 'sheets.googleapis.com' for consumer 'project_number:1001198111824'.",
"status": "RESOURCE_EXHAUSTED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developer console API key",
"url": "https://console.developers.google.com/project/1001198111824/apiui/credential"
}
]
}
]
}
}
但我的每100秒读取请求的限制是500
你能帮我修一下吗
五天前我仍然运行此代码,没有错误
抱歉,我的英语不太好请注意,除了每个项目每100秒500个请求的限制外,每个用户每100秒100个请求的限制也存在,请参阅。
仅此一点并不能解释为什么每103秒就有77个读取请求达到配额
但也要记住:
- 如果您不是管理员,管理员可能会将您的配额限制为每秒少于100个请求
- 配额不仅适用于读取请求,还包括您可能模拟的其他请求(例如写入),以及后台运行的其他代码的请求