2013-10-08 195 views
1

谷歌应用程序引擎重写默认提醒我写了插入事件,将使用谷歌日历API V3日历谷歌的App Engine的计划。该程序可以覆盖默认提醒设置。虽然该方案插入没有问题的情况下(无状态4XX),新插入的情况下仍然使用默认设置。建议将不胜感激!在谷歌日历API V3

这里还有一些细节:

1)在API控制台,我注册一个服务应用程序和下载的私钥。

2)I转换的PK12键到PEM

openssl pkcs8 -nocrypt -in privatekey.pem -passin pass:notasecret -topk8 

-out pk.pem

3)在日历设置,我同意通过其XXX @显影剂中的服务应用程序的日历.gserviceacount.com。

4)在日历设置,我给的程序来改变事件的能力。

5)我使用SignedJwtAssertionCredentials用于认证

f = file("pk.pem", "rb") 
key = f.read() 
f.close() 
credentials = SignedJwtAssertionCredentials(
        service_account_name='[email protected]', 
        private_key=key, 
        scope='https://www.googleapis.com/auth/calendar') 
http = credentials.authorize(httplib2.Http()) 
service = build('calendar', 'v3',http=http) 

6)我通过其calendarId指定日历。

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 
      } 
+0

您是否尝试过=“[email protected]”你SignedJWTAssertionCredential添加子? –

回答

0

对于我来说,对于编程插入事件的提醒,从我的默认日历,没有被加入到活动的日历即将到来。我从视图中滤除了我的默认日历以解决问题。我找不到任何其他方式(即提醒useDefault假,“假”,覆盖等)