"Quota exceeded for quota group 'ReadGroup' and limit 'Read requests per user per 100 seconds' of service google api

huangapple go评论86阅读模式
英文:

"Quota exceeded for quota group 'ReadGroup' and limit 'Read requests per user per 100 seconds' of service google 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个读取请求。你能帮我修复吗?五天前我还运行这个代码没有错误。

抱歉,我的英语不太好,但我会尽力帮助你。

英文:

My code that i try to count request api and time

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")

Last result :

Time:  103 sec

google read request:  77

then this error show


    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"
          }
        ]
      }
    ]
  }
}

but my limit quota read request per 100 sec is 500
enter image description here

could you help me to fix
five days ago i still run this code have no error

sorry about my english language is not well

答案1

得分: 2

请注意,除了每个项目每100秒500个请求的限制外,还有每个用户每100秒100个请求的限制,请参见此处

这仅仅不能解释为什么你在103秒内发出了77个读取请求,但也要记住:

  • 如果你不是管理员,你的管理员可能会将你的配额限制在每秒不到100个请求
  • 配额不仅适用于读取请求,还包括您可能同时进行的其他请求(例如写入),以及后台运行的其他代码的请求。
英文:

Be aware that apart from the limit of 500 requests per 100 seconds per project, there is also the limit of 100 requests per 100 seconds per user, see here.

This alone does not explain why you hit the quota with 77 read requests per 103 s,

but keep also in mind:

  • If you are not admin, your admin might restrict your quota to less than 100 requests per s
  • The quota does not apply to read requests only, but it also includes other requests you might have simulatenously (e.g. writing), and also requests of other codes running in the background.

huangapple
  • 本文由 发表于 2020年1月3日 16:19:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/59575214.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定