Home > Software design >  Google calendar api: getting eventdetails from different calendars
Google calendar api: getting eventdetails from different calendars

Time:01-10

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.

CodePudding user response:

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.

CodePudding user response:

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.

  • Related