I'm trying to use the the GData Python library to create a calendar
for a user. The logon (client based) works, getting the calendar feed
works, but then the code chokes on the InsertCalendar call. Here is
the snippet:
# Check for the master Google calendar, if not present create
one
calendar_service = gdata.calendar.service.CalendarService()
gdata.alt.appengine.run_on_appengine(calendar_service)
calendar_service.email = g_user
calendar_service.password = g_pass
calendar_service.source = GOOGLE_DICT['api-source']
calendar_service.ProgrammaticLogin()
logging.info(calendar_service.GetClientLoginToken()) <----
things are okay here
# Create the default calendar, if it is not there
feed = calendar_service.GetOwnCalendarsFeed()
logging.info('Obtained a feed: ' + feed.title.text) <----
things are okay here
if 'mydefault' not in ( c.title.text for c in feed.entry ):
logging.info('Default calendar not found, creating!')
calendar = gdata.calendar.CalendarListEntry()
calendar.title = atom.Title(text='mydefault')
new_calendar =
calendar_service.InsertCalendar(new_calendar=calendar) <---- Bombs
here!
logging.info(new_calendar.title)
The insert bombs with a 501 from the Googles <snipped>:
File "C:\Program Files\Google\google_appengine\academic\admin.py",
line 92, in post
new_calendar =
calendar_service.InsertCalendar(new_calendar=calendar)
File "C:\Program Files\Google\google_appengine\academic\gdata
\calendar\service.py", line 197, in InsertCalendar
converter=gdata.calendar.CalendarListEntryFromString)
File "C:\Program Files\Google\google_appengine\academic\gdata
\service.py", line 831, in Post
media_source=media_source, converter=converter)
File "C:\Program Files\Google\google_appengine\academic\gdata
\service.py", line 951, in PostOrPut
'reason': server_response.reason, 'body': result_body}
RequestError: {'status': 501, 'body': '\n\n<html><head>\n<meta http-
equiv="content-type" content="text/html;charset=utf-8">\n<title>501
Not Implemented</title>\
I am using the latest iterations of GAE and the Python lib (Local Dev
1.1.4 and GData Python 1.2.1).
I added the following at the top of my file just after my imports, but
to no avail:
gdata.service.http_request_handler = gdata.urlfetch
Any ideas / suggestions?