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

标签 python google-calendar-api

如果我在 Google 日历中写一些事件 例如:3 到 4 个事件,我如何启动 python 程序来使用 google API 获取所有这些事件?

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

print event['summary']

最佳答案

步骤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 

step3然后调用事件列表函数

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

引用https://developers.google.com/calendar/v3/reference/events/list

关于python - 如何使用 API 从 Google 日历获取事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55568820/

相关文章:

python - 在 OSX 上使用格式语言的德语数字分隔符?

python - 你如何看待使用 selenium 的 Chrome webdriver

javascript - 如何刷新客户端 Google api 访问 token ?

c# - 找不到 sendNotifications 选项 Google Calendar api v3 .NET

javascript - 来自多个文本框的多个 Google 事件

php - 如何使用 Google 的 "Simple API Access key"访问 Google 日历信息 (PHP)?

python - 将枚举映射到函数的最佳方法

Python pandas to_json() 格式无效

python - 无法显示静态图像和 css 文件

c++ - "Remember the milk"订阅日历的 Google 日历同步问题