Parsing atom response from InsertCalendar in Python on GAE (Calendar API)

308 views Asked by At

Using the GData Calendar API via App Engine in Python, when you create an event there are handy little helper methods to parse the response:

new_event = calendar_service.InsertEvent(event, '/calendar/feeds/default/private/full')
helper = new_event.GetEditLink().href

When you create a new calendar:

new_calendar = gd_client.InsertCalendar(new_calendar=calendar)

I was wondering if there might be related methods that I just can't find in the documentation (or that are--perhaps--undocumented)?

I need to store the new calendar's ID in the datastore, so I would like something along the lines of:

new_calendar = gd_client.InsertCalendar(new_calendar=calendar)
new_calendar.getGroupLink().href

In my code, the calendar is being created, and G is returning the Atom response with a 201, but before I get into using elementtree or atom.parse to extract the desired element, I was hoping someone here might be able to help.

Many thanks in advance :)

1

There are 1 answers

1
Xepo On

I've never used the GData API, so I could be wrong, but...

It looks like GetLink() will return the link object for any specified rel. Seems like GetEditLink() just calls GetLink(), passing in the rel of the Edit link. So you should be able to call GetLink() on the response from InsertCalendar(), and pass in the rel of the Group link.

Here's the pydoc info that I used to figure this out: http://gdata-python-client.googlecode.com/svn/trunk/pydocs/gdata.calendar_resource.data.html