Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending Google calendar event invite notifications using gdata python library

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.content = 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 = '[email protected]'))
client = gdata.calendar.service.CalendarService(email='[email protected]', 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?

like image 741
Rabih Avatar asked Jan 29 '26 05:01

Rabih


1 Answers

Actually, the proper syntax is:

from gdata.calendar.data import SendEventNotificationsProperty

# [...] stuff

entry.send_event_notifications = SendEventNotificationsProperty(value='true')
like image 122
mikenorton Avatar answered Jan 31 '26 19:01

mikenorton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!