Google日历重复事件的发生时间(Python API) [英] Time of occurence of a Google calendar recurring event (Python API)

查看:136
本文介绍了Google日历重复事件的发生时间(Python API)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In my program I use google-api-python-client to connect to the Calendar API. I make a query for the events for the next 3 days with:

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

结果是一个事件列表,该事件以Python字典为模型,大致如下所示(我省略了一些不必要的数据):

The result is a list of events, modelled in a Python dictionary, roughly looking like this (I omitted some unnecessary data):

{
     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
}

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

The above event is a recurring event, created several months ago, and the 'start' and 'end' fields reflect the date of the creation. There will be several copies of this event in the resulting list, since it occurs several times between the 'timeMin' and 'timeMax' range.

现在,问题是我没有事件确切发生的dateTime(在这种情况下应该是2013-01-04T00:08:00 + 01:00).有人知道我是否可以从Google Calendar API获得该时间(我正在通过其python软件包使用版本3)?

Now, the problem is I don't have the dateTime of the exact occurrence of the event (should be 2013-01-04T00:08:00+01:00 in this case). Anyone knows if I can get that time from the Google Calendar API (I'm using version 3 via their python package)?

还是会建议如何在客户端实现它?

Or would suggest how to implement it on the client side?

推荐答案

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

Reading the docs again at https://developers.google.com/google-apps/calendar/v3/reference/events/list

我发现我已经忽略了这一点:

I've found I've overlooked this:

singleEvents布尔值

singleEvents boolean

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

Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves. Optional. The default is False.

这篇关于Google日历重复事件的发生时间(Python API)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆