You need to specify the When object with start and end time when creating an
event, sorry I assumed that you already have that, so this is a function
that I use to create event -

def createEvent():
  event = gdata.calendar.CalendarEventEntry()
  event.title = atom.Title(text='Python: create event')
  event.content = atom.Content(text='blah')
  start_time = '2008-03-25T09:00:00.000-07:00'
  end_time = '2008-03-25T10:00:00.000-07:00'
  event.when.append(gdata.calendar.When(start_time=start_time,
  end_time=end_time))
  who = gdata.calendar.Who()
  who.email = '[EMAIL PROTECTED]'
  who.valueString = 'John Doe'
  event.who.append(who)

Hope it helps,
Austin


On Wed, Mar 26, 2008 at 12:55 PM, wannjanjic <[EMAIL PROTECTED]> wrote:

>
> Hi Austin, my code now looks something like this:
>
> gCalendar = gdata.calendar.service.CalendarService()
> gCalendar.email = '[EMAIL PROTECTED]'
> gCalendar.password = 'some_password'
> gCalendar.ProgrammaticLogin()
>
> guest = gdata.calendar.Who()
> guest.email = '[EMAIL PROTECTED]'
> guest.valueString = 'some_name'
>
> ev = gdata.calendar.CalendarEventEntry()
> ev.title = 'Some Title'
> ev.content = 'Some Content'
> ev.send_event_notifications = 'true'
> ev.who.append(guest)
>
> gCalendar.InsertEvent(ev, '/calendar/feeds/default/private/full')
>
> but the error is still the same. Where am I wrong? Thanks,
> Ivan
>
> On Mar 26, 7:14 pm, "Austin (Google)" <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > event.who is actually a list, and this is what causing your error.  So
> to
> > add a gdata.calendar.Who object to this list you need to use the method
> > append(), just like you did for the event.when.  It should look like
> this
> >
> > guest = gdata.calendar.Who()
> > guest.email = '[EMAIL PROTECTED]'
> > guest.valueString = 'John Doe'
> >
> > event.who.append(guest)
> >
> > Hope it helps,
> > Austin
> >
> > On Tue, Mar 25, 2008 at 12:04 PM, wannjanjic <[EMAIL PROTECTED]>
> wrote:
> >
> > > Hi,
> > > first of all thanks to google for this excelent API.
> > > I have a little problem. Here it is:
> >
> > > I'm trying to to invite others to the event by using this code:
> >
> > > event = gdata.calendar.CalendarEventEntry()
> > > event.title = 'some_title'
> > > event.content = 'some_content'
> >
> > > invite = gdata.calendar.Who()
> > > invite.email = '[EMAIL PROTECTED]'
> > > invite.name = 'some_name'
> >
> > > event.send_event_notifications = 'true'
> > > event.who = invite
> > > new_event calendar_service.InsertEvent(ev, '/calendar/feeds/default/
> > > private/full')
> >
> > > but I'm getting this error:
> >
> > > File "<input>", line 1, in <module>
> > >  File "/usr/lib/python2.5/site-packages/gdata/calendar/service.py",
> > > line 148, in InsertEvent
> > >    escape_params=escape_params)
> > >  File "/usr/lib/python2.5/site-packages/gdata/service.py", line 723,
> > > in Post
> > >    extra_headers, url_params, escape_params, content_type)
> > >  File "/usr/lib/python2.5/site-packages/atom/service.py", line 317,
> > > in Post
> > >    data_str = str(data)
> > >  File "/usr/lib/python2.5/site-packages/atom/__init__.py", line 313,
> > > in __str__
> > >    return self.ToString()
> > >  File "/usr/lib/python2.5/site-packages/atom/__init__.py", line 310,
> > > in ToString
> > >    return ElementTree.tostring(self._ToElementTree(),
> > > encoding=string_encoding)
> > >  File "/usr/lib/python2.5/site-packages/atom/__init__.py", line 305,
> > > in _ToElementTree
> > >    self._AddMembersToElementTree(new_tree)
> > >  File "/usr/lib/python2.5/site-packages/atom/__init__.py", line 270,
> > > in _AddMembersToElementTree
> > >    member._BecomeChildElement(tree)
> > > AttributeError: 'str' object has no attribute '_BecomeChildElement'
> >
> > > I'm trying to figure out the solution for a couple of days, but this
> > > error is keep showing.
> > > I'm a noob in phyton so any help is welcome.
> > > Thanks in advance and best regards,
> > > Ivan
> >
>

--~--~---------~--~----~------------~-------~--~----~
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