使用 gdata python 库发送 Google 日历活动邀请通知

发布于 2024-10-31 05:20:14 字数 1208 浏览 4 评论 0原文

我正在使用 Google 的 gdata 库在 python 中以编程方式创建日历事件。到目前为止,以下代码工作正常,除了一件事:

我一生都无法让它向被邀请者(或被邀请者列表)发送邀请通知:

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')

标记行是我认为有必要发送的内容邀请通知,但不起作用。有什么想法吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

纸伞微斜 2024-11-07 05:20:14

实际上,正确的语法是:

from gdata.calendar.data import SendEventNotificationsProperty

# [...] stuff

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

Actually, the proper syntax is:

from gdata.calendar.data import SendEventNotificationsProperty

# [...] stuff

entry.send_event_notifications = SendEventNotificationsProperty(value='true')
旧伤还要旧人安 2024-11-07 05:20:14

您可以使用:

from gdata.calendar import SendEventNotifications

# [...] stuff

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

You may use:

from gdata.calendar import SendEventNotifications

# [...] stuff

entry.send_event_notifications = SendEventNotifications(value='true')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文