python-3.x - “配额组'ReadGroup'的配额超出并限制'每100秒每个用户的读取请求'服务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+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 个请求
- 配额不仅适用于读取请求,还包括您可能同时拥有的其他请求(例如写入),以及在后台运行的其他代码的请求。
推荐阅读
- python - psycopg2.OperationalError:SSL SYSCALL 错误:在 Flask/SQLAclemy/Celery + PostgreSQL 应用程序上检测到 EOF
- visual-studio - CMake Visual Studio 生成器表达式 RelWithDebInfo
- jmeter - Jmeter SSHMON 样本收集器的问题(插件未解析接收到的数据)
- arrays - 带有对象引用和自定义值的 Moongose 数组
- c++ - 使用 C++ 计算 926 以下的所有 7 和 11 的倍数之和
- php - 如何用第二个数组合并和覆盖第一个数组?
- python - SyntaxError:无效的语法 python nltk
- svelte - Sapper/svelte - 集成引用“窗口”和“文档”的旧 js 库
- mongodb - Mongodb 聚合,在 groupBy 上获得预期结果,无需硬编码类别
- macos - macOS 上已保存 .webarchive 的原始 URL