【发布时间】:2021-09-26 15:42:23
【问题描述】:
我创建了一个不和谐机器人,它需要访问我的 Google 表格和 Google 日历。为此,我在 google 控制台上创建了一个项目,并启用了驱动器、工作表和其他所需的 API。然后我下载了凭据并将其重命名为creds.json。
这是我从我的 Google 帐户访问名为 Responses 的电子表格的操作。
scope = ['https://spreadsheets.google.com/feeds',
'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('creds.json', scope)
client = gspread.authorize(creds)
sheet = client.open('Responses')
这一切都是在我的本地系统上完成的。但现在,我希望任何人都能够邀请这个机器人并允许它访问他们的 Google 产品,如表格、日历等,这样机器人就可以完成它的工作。如何自动化启用 API 和使用邀请人凭据的过程?还是有其他方法?
我们将不胜感激任何形式的帮助。谢谢。
【问题讨论】:
标签: python api google-sheets discord.py