【问题标题】:Sending Google calendar event invite notifications using gdata python library使用 gdata python 库发送 Google 日历活动邀请通知
【发布时间】:2012-11-28 23:03:45
【问题描述】:

我正在使用 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 = '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')

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

【问题讨论】:

    标签: python gdata-api


    【解决方案1】:

    其实正确的语法是:

    from gdata.calendar.data import SendEventNotificationsProperty
    
    # [...] stuff
    
    entry.send_event_notifications = SendEventNotificationsProperty(value='true')
    

    【讨论】:

      【解决方案2】:

      你可以使用:

      from gdata.calendar import SendEventNotifications
      
      # [...] stuff
      
      entry.send_event_notifications = SendEventNotifications(value='true')
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-01-02
        • 2015-12-10
        • 1970-01-01
        • 1970-01-01
        • 2017-06-18
        • 2014-05-04
        • 2013-06-09
        • 1970-01-01
        相关资源
        最近更新 更多