gspread中每100秒每用户的读取请求数限制已超过配额,但Console Cloud Google仅显示24个请求

问题描述

我有一个程序,该程序需要从15个Google表格中提取行(以及其他一些请求),但是如果我在运行代码时未在每个读取函数之间插入time.sleep(20),则会收到以下消息:

超出了配额组“ ReadGroup”的配额,并限制了“每100秒每用户的读取请求” 服务

问题是,如果我在Google Console Cloud上进行检查,则显示我每100秒只调用了24个请求。我读到该限制可能还包括其他API请求,但是每100秒我加起来几乎只有40个请求,而每人100个限制。 读取的Google Sheet API组的峰值是每100秒24个请求:

大多数Google工作表的行数都不超过20,而每列都有10列

对于引用,我将代码添加到收到错误的位置

GSPREAD_ScopES =[
        'https://www.googleapis.com/auth/spreadsheets','https://www.googleapis.com/auth/drive'
    ]

gc = activate_gspread(credentials_raw,GSPREAD_ScopES)

def get_sheets(sheet):
    return gc.open_by_key(sheet)

# players_sheets is a list of all the players to read
for player in players_sheets:
    # gsheets is a dictionary that pairs player with the corresponding google sheet
    input_sheet = get_sheets(gsheets[player])
    sheet = input_sheet.sheet1.get_all_values() # Here I receive the error usually around the loop number 10-12
    table = pd.DataFrame(sheet[1:],columns = sheet[0])

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)