2013-10-08 192 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假,「假」,覆蓋等)