如何修复";google.auth.exceptions.RefreshError:('响应中没有访问



我一步一步地关注TechWithTim的视频(https://www.youtube.com/watch?v=cnPlKLEGR7E)但是当我试着打开床单的时候,还是会出错。代码在sheet = client.open("GuildTaxes").sheet1行之前运行良好。这是我的密码。

import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ["https://spreadsheets.google.com/feeds","https://www.googleapis.com/auth/sprea...",
"https://www.googleapis.com/auth/drive...","https://www.googleapis.com/auth/drive"]
creds = ServiceAccountCredentials.from_json_keyfile_name("GuildTaxes-9ba4508be840.json", scope)
client = gspread.authorize(creds)
sheet = client.open("GuildTaxes").sheet1
data = sheet.get_all_records()
print(data)

我找到了答案!2个小时后,TechWithTim视频中的范围对我不起作用,所以如果你遇到同样的问题,请尝试使用这个

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

它是默认范围。

最新更新