简体   繁体   English

谷歌日历 api:从不同的日历获取事件详细信息

[英]Google calendar api: getting eventdetails from different calendars

Is it possible with python and the google calendar api to retrieve event details from different calendars.是否可以使用 python 和谷歌日历 api 从不同的日历中检索事件详细信息。

For example: I want to display a family calendar on one screen.例如:我想在一个屏幕上显示一个家庭日历。 To do this, I want to retrieve all the appointments from the calendars of my wife, my children and me.为此,我想从我妻子、孩子和我的日历中检索所有约会。

I already tried the quickstart.py script from google and added an array with the different calendar ids.我已经尝试过来自谷歌的 quickstart.py 脚本并添加了一个具有不同日历 ID 的数组。 But it only retreived event details from one calendar.但它只从一个日历中检索事件详细信息。

The events.list method is singular. events.list方法是单数的。

Returns events on the specified calendar.返回指定日历上的事件。

It will only return to you events for the calendar you are questing data for.它只会向您返回您正在为其查询数据的日历的事件。 Your going to have to do it once for each calendar.你将不得不为每个日历做一次。

There's no way to do this with one request.没有办法通过一个请求来做到这一点。 With gcsa you can do:使用gcsa ,您可以:

from gcsa.google_calendar import GoogleCalendar

gc = GoogleCalendar()
events = list(gc.get_events(start, end, calendar_id='calendar1'))
events.extend(gc.get_events(start, end, calendar_id='calendar2'))
events.extend(gc.get_events(start, end, calendar_id='calendar3'))
...

events.sort() # if you need to sort events by time

But you need to have an access to all calendars.但是您需要有权访问所有日历。

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

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