Google 日历重复事件发生的时间(Python API)

gda*_*jan 0 python google-calendar-api

在我的程序中,我使用 google-api-python-client 连接到日历 API。我通过以下方式查询未来 3 天的事件:

service = build(serviceName='calendar', version='v3', http=http)
events = service.events().list(
      calendarId=calendarId,
      timeMin='2013-01-04T00:00:00+01:00',
      timeMax='2013-01-06T00:00:00+01:00').execute()
Run Code Online (Sandbox Code Playgroud)

结果是一个事件列表,在 Python 字典中建模,大致如下(我省略了一些不必要的数据):

{
     u'created': u'2012-11-26T00:54:43.000Z',
     u'description': u'abc abc',
     u'start': {u'dateTime': u'2012-11-26T08:00:00+01:00',
                u'timeZone': u'Europe/Copenhagen'},
     u'end': {u'dateTime': u'2012-11-26T10:00:00+01:00',
              u'timeZone': u'Europe/Copenhagen'},
     u'kind': u'calendar#event',
     u'recurrence': [u'RRULE:FREQ=DAILY'],
     u'sequence': 0
}
Run Code Online (Sandbox Code Playgroud)

上述事件是一个重复事件,在几个月前创建,“开始”和“结束”字段反映了创建日期。结果列表中将存在此事件的多个副本,因为它在“timeMin”和“timeMax”范围之间发生多次。

现在,问题是我没有事件确切发生的日期时间(在本例中应该是 2013-01-04T00:08:00+01:00)。有人知道我是否可以从 Google Calendar API 获取该时间(我通过他们的 python 包使用版本 3)?

或者建议如何在客户端实现它?

gda*_*jan 5

再次阅读文档 https://developers.google.com/google-apps/calendar/v3/reference/events/list

我发现我忽略了这一点:

单事件布尔值

是否将重复事件扩展为实例,并且仅返回单个一次性事件和重复事件的实例,而不返回底层重复事件本身。选修的。默认值为 False。