编程语言
首页 > 编程语言> > 如何为非主要日历插入新事件?使用python gdata

如何为非主要日历插入新事件?使用python 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')

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

解决方法:

好的,我在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

标签:gdata,gdata-api,python,django
来源: https://codeday.me/bug/20191210/2101158.html