繁体   English   中英

如何使用API​​从Google日历获取事件

[英]how to fetch events from google calender using API

如果我在Google Calender ex中编写了一些事件:3到4个事件我如何启动python程序以使用Google API提取所有这些事件?

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

print event['summary']

第1步。 您需要日历ID。

第2步。 您需要Google凭据。 启用Google Calendar 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()

参考https://developers.google.com/calendar/v3/reference/events/list

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM