Simon Flückiger
Simon Flückiger

Reputation: 23

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.

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. But it only retreived event details from one calendar.

Upvotes: 0

Views: 445

Answers (2)

Yevhen Kuzmovych
Yevhen Kuzmovych

Reputation: 12140

There's no way to do this with one request. With gcsa you can do:

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.

Upvotes: 0

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116958

The events.list method is singular.

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.

Upvotes: 1

Related Questions