如何为非主日历插入新事件?使用python gdata

时间:2009-12-28 23:26:05

标签: python django gdata-api gdata

def addEvent(calendar_service):
    event = gdata.calendar.CalendarEventEntry()
    event.content = atom.Content(text='Tennis with John 30.12.2009 15:00-16:00')
    event.quick_add = gdata.calendar.QuickAdd(value='true')
    new_event = calendar_service.InsertEvent(event, '/calendar/feeds/default/private/full')

这写入主日历。我如何将/ InsertEvent写入我的“foo”日历? 谢谢!

2 个答案:

答案 0 :(得分:3)

好的,我发现 a_calendar.content.src 中的网址显示为“http://www.google.com/calendar/feeds/”+ id +“/ private / full”

def addEvent(calendar_service):
    event = gdata.calendar.CalendarEventEntry()
    event.content = atom.Content(text='Tennis with John 30.12.2009 15:00-16:00')
    event.quick_add = gdata.calendar.QuickAdd(value='true')
    feed = calendar_service.GetOwnCalendarsFeed()
    calurl=[a_calendar.content.src for i, a_calendar in enumerate(feed.entry)]
    new_event = calendar_service.InsertEvent(event, calurl[1]) #calurl[1] select the 2. cal of own's cals

答案 1 :(得分:0)

尝试为InsertEvent指定其他URL。请参阅retrieving calendars上的文档或尝试使用GET点击列出的网址。在InsertEvent调用中使用检索到的日历的URL而不是“/ calendar / feeds / default / private / full”。