Search code examples
google-calendar-apigdata

Getting Google Calendar event by id with Python and gdata library


How could I get an event from a specific Google Calendar using gdata library and knowing the event id? I can't see an example like that in the documentation.

I know I can (and should) use v3 API and python-api-client, but I want to add and modify events in all the users's calendars from a Google Apps domain, without user's intervention. Is there a better way to do this?

Thanks in advance, and best regards


Solution

  • Self-response:

    from gdata.calendar.client import *
    from gdata.calendar import *
    
    gdclient = gdata.calendar.client.CalendarClient(source = 'testing')
    
    gdclient.ClientLogin(ADMIN_USER_LOGIN, ADMIN_USER_PASSWORD, gdclient.source)
    
    feed_uri = gdclient.get_calendar_event_feed_uri(calendar = THE_USER_EMAIL)
    
    event_uri = feed_uri + '/' + THE_EVENT_ID
    
    calendar_entry = gdclient.get_calendar_entry(event_uri, desired_class=gdata.calendar.data.CalendarEventEntry))
    

    One thing I've realized is there's no way to change the event's color (or, at least, I've not found it). This is possible with Google Calendar API v3.