Python 谷歌应用引擎覆盖谷歌日历API V3中的默认提醒
我已经编写了一个Google应用程序引擎程序,它使用Google calendar API V3将事件插入日历。该程序可以覆盖默认提醒设置。尽管程序插入事件时没有问题(无状态4xx),但新插入的事件仍使用默认设置。建议将不胜感激 以下是一些细节: 1) 在API控制台中,我注册一个服务应用程序并下载私钥 2) 我将PK12密钥转换为PEMPython 谷歌应用引擎覆盖谷歌日历API V3中的默认提醒,python,google-app-engine,google-calendar-api,Python,Google App Engine,Google Calendar Api,我已经编写了一个Google应用程序引擎程序,它使用Google calendar API V3将事件插入日历。该程序可以覆盖默认提醒设置。尽管程序插入事件时没有问题(无状态4xx),但新插入的事件仍使用默认设置。建议将不胜感激 以下是一些细节: 1) 在API控制台中,我注册一个服务应用程序并下载私钥 2) 我将PK12密钥转换为PEM openssl pkcs8 -nocrypt -in privatekey.pem -passin pass:notasecret -topk8 -out
openssl pkcs8 -nocrypt -in privatekey.pem -passin pass:notasecret -topk8
-out pk.pem
3) 在“日历设置”中,我通过服务应用程序共享日历xxx@developer.gserviceacount.com.
4) 在日历设置中,我赋予程序更改事件的能力
5) 我使用SignedJwtAssertionCredentials进行身份验证
f = file("pk.pem", "rb")
key = f.read()
f.close()
credentials = SignedJwtAssertionCredentials(
service_account_name='xxxx@developer.gserviceaccount.com',
private_key=key,
scope='https://www.googleapis.com/auth/calendar')
http = credentials.authorize(httplib2.Http())
service = build('calendar', 'v3',http=http)
6) 我通过日历ID指定日历
service.events().insert(calendarId='@group.calendar.google.com',body=event).execute()
反过来,活动是:
event = { 'summary': 'Appointment from Google App Engine',
'location': 'Somewhere',
'start': {
'dateTime': start_time
},
'end': {
'dateTime': end_time
},
"reminders":
{
"useDefault": "False",
"overrides": [
{
"method": "email",
"minutes": reminder_period
},
]
},
"description": description
}
对我来说,按程序插入的事件的提醒来自我的默认日历,而不是添加事件的日历。我从视图中筛选出默认日历以解决此问题。我找不到任何其他方法(例如默认值为False、“False”、覆盖等)您是否尝试添加sub=”email@example.com“给你签名的JWTAssertionCredential?