Hi Elmore, I'm guessing that this 501 error will only occur when your code is running in the SDK. The Calendar service sometimes responds with a 302 redirect and the SDK's version of urlfetch retries the POST as a GET, which is why the Calendar server responds with "Not Implemented". On the App Engine servers, urlfetch will correctly retry with a POST so this is not an issue if you've uploaded your app.
I added a workaround for this issue in revision 534 of the gdata- python-client: http://code.google.com/p/gdata-python-client/source/detail?r=534 You can either add this change into your copy of the library, checkout the latest revision from subversion, or wait for a future release :) Happy coding, Jeff On Oct 1, 6:37 pm, Elmore <[EMAIL PROTECTED]> wrote: > 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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
