I'm trying to add an event to a calendar, the Python gdata lib
(1.2.4).

I am getting the following error when calling InsertEvent:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "makerotation.py", line 60, in Test
    ScheduleEvent(calendar_service,event)
  File "makerotation.py", line 24, in ScheduleEvent
    '/calendar/feeds/
google.com_r6oah4kurfoe0i3kee16kaitq0%40group.calendar.google.com/
private/full')
  File "/home/ifette/gdata/lib/python/gdata/calendar/service.py", line
159, in InsertEvent
    converter=gdata.calendar.CalendarEventEntryFromString)
  File "/home/ifette/gdata/lib/python/gdata/service.py", line 1147, in
Post
    media_source=media_source, converter=converter)
  File "/home/ifette/gdata/lib/python/gdata/service.py", line 1267, in
PostOrPut
    'reason': server_response.reason, 'body': result_body}
gdata.service.RequestError: {'status': 411, 'body': '\n\n<html><head>
\n<meta http-equiv="content-type" content="text/html;charset=utf-8">
\n<title>411 Length Required</title>\n<style><!--\nbody {font-family:
arial,sans-serif}\ndiv.nav {margin-top: 1ex}\ndiv.nav A {font-size:
10pt; font-family: arial,sans-serif}\nspan.nav {font-size: 10pt; font-
family: arial,sans-serif; font-weight: bold}\ndiv.nav A,span.big {font-
size: 12pt; color: #0000cc}\ndiv.nav A {font-size: 10pt; color: black}
\nA.l:link {color: #6f6f6f}\nA.u:link {color: green}\n//--></style>
\n<script><!--\nvar rc=411;\n//-->\n</script>\n</head>\n<body
text=#000000 bgcolor=#ffffff>\n<table border=0 cellpadding=2
cellspacing=0 width=100%><tr><td rowspan=3 width=1% nowrap>\n<b><font
face=times color=#0039b6 size=10>G</font><font face=times
color=#c41200 size=10>o</font><font face=times color=#f3c518
size=10>o</font><font face=times color=#0039b6 size=10>g</font><font
face=times color=#30a72f size=10>l</font><font face=times
color=#c41200 size=10>e</font>&nbsp;&nbsp;</b>\n<td>&nbsp;</td></tr>
\n<tr><td bgcolor="#3366cc"><font face=arial,sans-serif
color="#ffffff"><b>Error</b></td></tr>\n<tr><td>&nbsp;</td></tr></
table>\n<blockquote>\n<H1>Length Required</H1>\nPOST requests require
a <code>Content-length</code> header.\n\n<p>\n</blockquote>\n<table
width=100% cellpadding=0 cellspacing=0><tr><td bgcolor="#3366cc"><img
alt="" width=1 height=4></td></tr></table>\n</body></html>\n',
'reason': 'Length Required'}
>>>


I have no idea why the API is giving me issues with content length.
The run_data_tests test works, so I think everything is set up fine,
and I can print a list of calendars - it's just when I get to this
point of inserting a calendar that I have an issue.

I'm creating my calendar_service as follows:

  calendar_service.email = '[email protected]'
  calendar_service.password = '...'
  calendar_service.source = 'ifette_makerotation.py'
  calendar_service.account_type = 'HOSTED'
  calendar_service.ProgrammaticLogin()

the event like so:

event = gdata.calendar.CalendarEventEntry()
  event.title = 'Build Sheriffs: %s, %s' % (sheriff1_name,
sheriff2_name)
  event.description = 'Build sheriffs for the Chrome tree'
  start_time = start_day
  end_time = start_time + datetime.timedelta(days=2)
  if (start_time.isoweekday() == 5):
    end_time = start_time + datetime.timedelta(days=4)

  event.when.append(gdata.calendar.When(start_time=start_time,
                                        end_time=end_time))
  who1 = gdata.calendar.Who()
  who1.email = sheriff1_email
  who1.ValueString = sheriff1_name
  who2 = gdata.calendar.Who()
  who2.email = sheriff2_email
  who2.ValueString = sheriff2_name

  event.who.append(who1)
  event.who.append(who2)

and inserting as follows:

  new_event = calendar_service.InsertEvent(event,
      '/calendar/feeds/
google.com_r6oah4kurfoe0i3kee16kaitq0%40group.calendar.google.com/
private/full')
  print 'New event inserted: %s' % (new_event.id.text,)
  print '\tEvent HTML URL: %s' % (new_event.GetHtmlLink().href,)


and then i get the giant error I posted above. Any ideas?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" 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-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to