【发布时间】:2019-05-10 20:05:56
【问题描述】:
我目前正在尝试通过 python 更新谷歌表格,但我遇到了一些权限问题。
我一直按照 Twilio 指南中的说明进行操作:https://www.twilio.com/blog/2017/02/an-easy-way-to-read-and-write-to-a-google-spreadsheet-in-python.html
我在 Jupyter 中完成了所有这些工作,并且我确实将 JSON 文件保存到了正确的代码目录中。我在定义范围、信誉和客户方面没有任何问题。
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_id.json', scope)
client = gspread.authorize(creds)
sheet = client.open("MixIQ Tracker").sheet1
我已按照所有步骤链接这两者,但最后一行出现此 API 错误。
APIError: {
"error": {
"errors": [{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission: Request had insufficient authentication scopes."
}],
"code": 403,
"message": "Insufficient Permission: Request had insufficient authentication scopes."
}
}
我不确定如何解决这个问题。任何方向将不胜感激!
【问题讨论】:
-
你试过这个吗:*.com/questions/38534801/…