开发者

Sending Google calendar event invite notifications using gdata python library

开发者 https://www.devze.com 2023-02-23 12:00 出处:网络
I am using Google\'s gdata library to create calendar events programmatically in python. So far the following code is working fine except for one thing:

I am using Google's gdata library to create calendar events programmatically in python. So far the following code is working fine except for one thing:

I can't for the life of me get it to send an invite notification to the invitee (or list of invitees):

import datetime
import atom
import gdata.calendar.service  
from gdata.calendar import Who, Where, When

entry = gdata.calendar.CalendarEventEntry()  
entry.title = atom.Title(text = 'event-title')
entry.co开发者_运维技巧ntent = atom.Content(text = 'some event etc...')
entry.send_event_notifications = atom.Entry(text = 'true') #<<<<<<<<<<<<<<<<<
start = datetime.datetime.now().isoformat()
entry.when.append(When(start_time=start))
entry.where.append(Where(value_string='somewhere'))
entry.who.append(Who(email = 'invitee@gmail.com'))
client = gdata.calendar.service.CalendarService(email='inviter@gmail.com', password='pa$$word')
client.ProgrammaticLogin()
event = client.InsertEvent(entry,'http://www.google.com/calendar/feeds/default/private/full')

The marked line is what I think is necessary to send the invite notifications, but it's not working. Any ideas?


Actually, the proper syntax is:

from gdata.calendar.data import SendEventNotificationsProperty

# [...] stuff

entry.send_event_notifications = SendEventNotificationsProperty(value='true')


You may use:

from gdata.calendar import SendEventNotifications

# [...] stuff

entry.send_event_notifications = SendEventNotifications(value='true')
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号