【问题标题】:Exceeding Google Sheets API with GSpread使用 GSpread 超越 Google Sheets API
【发布时间】:2022-01-21 22:11:09
【问题描述】:
def printit():
  threading.Timer(10.0, printit).start()
  newIDS = wks.acell('A2').value
  inProgIDS = wks.acell('B2').value
  completedIDS = wks.acell('C2').value
  
  
  ticketData = {
            "newIDS" : newIDS,
            "inProgIDS" : inProgIDS,
            "completedIDS" : completedIDS,
  }
  
  with open('ids.json', 'w') as url_file:
    json.dump(ticketData, url_file)

 
printit()

我每 10 秒使用 GSpread 对 Google Api 执行一次 ping 操作,以从 3 个单元格中获取一些值。它说我超出了我的配额,但是当我进入配额页面时,它显示使用率为 17%。

gspread.exceptions.APIError: {'code': 429, 'message': "配额指标 'Read requests' 超出配额并限制服务 'sheets.googleapis.com' 的'Read requests per minute per user' for消费者 'project_number:206671335281'.", 'status': 'RESOURCE_EXHAUSTED', 'details': [{'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'RATE_LIMIT_EXCEEDED', '域':'googleapis.com','元数据':{'quota_limit':'ReadRequestsPerMinutePerUser','quota_metric':'sheets.googleapis.com/read_requests','服务':'sheets.googleapis.com','消费者': 'projects/20}}]}

【问题讨论】:

    标签: google-sheets-api gspread


    【解决方案1】:

    您可能超出了配额。确保你没有结束60 requests per minute

    解决方法是实现exponential backoff

    花更多时间提出请求或仔细检查您正在读取的文件是否有其他需要更多请求的数据

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-31
      • 2015-10-23
      • 1970-01-01
      相关资源
      最近更新 更多