为了测试我们的应用程序,我需要插入/更新谷歌日历事件并验证边缘情况,例如,如果会议邀请是> 30天,则不应向最终用户显示。我正在为单个gmail id testaccount @ .com进行此设置,并尝试操纵事件以涵盖所有边缘情况。
点击此链接 - https://developers.google.com/calendar/v3/reference/events/insert
1)我创建了一个新项目https://console.cloud.google.com。
2)启用Google Calendar API
3)为credentials.json设置OAuth客户端
4)让python快速启动以获得10个日历事件 - 验证第3步是否正确。
5)现在在同意屏幕https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/calendar.events上插入一个添加了以下范围的事件
6)重新生成凭证,以便它具有新添加的插入事件的范围。
我收到以下错误消息 - 请求https://www.googleapis.com/calendar/v3/calendars/primary/events?alt=json返回时HttpError 403“权限不足:请求的身份验证范围不足。”
我也尝试使用电子邮件ID代替“主要”,并再次以相同的错误结束。
我遇到了同样的问题(=错误信息)。在演示软件的顶部查看以下行:
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']
并修改为
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/calendar']
然后删除你的token.pickle文件,然后重新运行你的脚本。