Python 如何使用API从google日历获取事件

Python 如何使用API从google日历获取事件,python,google-calendar-api,Python,Google Calendar Api,如果我在谷歌日历上写一些事件 例:3到4个事件如何启动python程序以使用GoogleAPI获取所有这些事件 event = service.events().get(calendarId='primary', eventId='eventId').execute() print event['summary'] 第一步。您需要日历id 第二步。你需要谷歌认证。这使谷歌日历api的功能 #this code you can use at google app engine def get_

如果我在谷歌日历上写一些事件 例:3到4个事件如何启动python程序以使用GoogleAPI获取所有这些事件

event = service.events().get(calendarId='primary', eventId='eventId').execute()

print event['summary']

第一步。您需要日历id

第二步。你需要谷歌认证。这使谷歌日历api的功能

#this code you can use at google app engine
def get_service():
    from googleapiclient.discovery import build
    from oauth2client.client import GoogleCredentials
    credentials = GoogleCredentials.get_application_default()
    service = build('calendar', 'v3', credentials=credentials)
    return service 
步骤3然后调用事件列表函数

 service = get_service()
 events = service.events().list(calendarId='calendarId').execute()

参考第1步。您需要日历id

第二步。你需要谷歌认证。这使谷歌日历api的功能

#this code you can use at google app engine
def get_service():
    from googleapiclient.discovery import build
    from oauth2client.client import GoogleCredentials
    credentials = GoogleCredentials.get_application_default()
    service = build('calendar', 'v3', credentials=credentials)
    return service 
步骤3然后调用事件列表函数

 service = get_service()
 events = service.events().list(calendarId='calendarId').execute()

参考

希望这会有帮助:一个好的开始是基本的python教程,然后是希望这会有帮助:一个好的开始是基本的python教程,然后是