Google Calendar Python API: creating an event with specified start and end time zones

Let's say I got the following start and end times for the event I want to create:

import pytz
import datetime

start_zone = pytz.timezone('Europe/London')
end_zone = pytz.timezone('Europe/Oslo')

start_time = datetime.datetime(2011,5,13,15,0, tzinfo=start_zone)
end_time = datetime.datetime(2011,5,13,19,0, tzinfo=end_zone)

Is it possible to create an event with the start and end times of the corresponding time zones?

In the Google Calendar GUI, this can be done by clicking on Time Zone → individual time zones / time on the event editing page. However, when I try to execute this code,

event = gdata.calendar.CalendarEventEntry()
event.when.append(gdata.calendar.When(start_time=start_time.isoformat(), end_time=end_time.isoformat()))

time zone information is not added, although it start_time.isoformat()contains time zone information.

EDIT: Forgot to add that the event is created from 16:00 to 19:00 in the calendar set to GMT + 0 (London).

+3
source share

All Articles