Google日历API提供的信息比所需的更多信息

发布于 2025-02-11 19:21:18 字数 1531 浏览 2 评论 0原文

我是初学者的程序员,所以不要仇恨。

我有以下电话:

        eevents = service.events().list(calendarId='primary', pageToken=page_token, timeMax = "2022-07-01T00:00:00Z",
                                       timeMin = "2022-06-28T00:00:00Z").execute()
        for event in events['items']:
            print(event.items())
        page_token = events.get('nextPageToken')
        if not page_token:
           break

但是我会在指定的时间范围之外获得事件,例如:|

('start', {'dateTime': '2022-05-02T10:00:00+02:00', 'timeZone': 'Europe/Prague'}), ('end', {'dateTime': '2022-05-02T11:00:00+02:00', 'timeZone': 'Europe/Prague'}),

此外, https://developers.google.com/日历/api/v3/reference/events/list 如下:

{
"kind": "calendar#events",
  "etag": etag,
  "summary": string,
  "description": string,
  "updated": datetime,
  "timeZone": string,
  "accessRole": string,
  "defaultReminders": [
    {
      "method": string,
      "minutes": integer
    }
  ],
  "nextPageToken": string,
  "nextSyncToken": string,
  "items": [
    events Resource
  ]
}

但是除了预期的字典键和值,我在元组中获得了信息。例如:

('kind', 'calendar#event'), ('etag', '"3306952077924000"'), ('id', '5qcpuj5r1k35v533slhljtgh9g'), ('status', 'confirmed')

第二件事很有意义。我的事件中还有更多的基线信息,因此还有更多的信息添加,但是由于它比预期的要多。

这确实是第一个让我困扰我的事件的问题。第二个问题只是直觉,这两件事可能是相关的。

I am a beginner programmer so pls no hate.

I have the following call:

        eevents = service.events().list(calendarId='primary', pageToken=page_token, timeMax = "2022-07-01T00:00:00Z",
                                       timeMin = "2022-06-28T00:00:00Z").execute()
        for event in events['items']:
            print(event.items())
        page_token = events.get('nextPageToken')
        if not page_token:
           break

But I get events outside the the specified time frame such as:|

('start', {'dateTime': '2022-05-02T10:00:00+02:00', 'timeZone': 'Europe/Prague'}), ('end', {'dateTime': '2022-05-02T11:00:00+02:00', 'timeZone': 'Europe/Prague'}),

Additionally, the expected response at https://developers.google.com/calendar/api/v3/reference/events/list is the following:

{
"kind": "calendar#events",
  "etag": etag,
  "summary": string,
  "description": string,
  "updated": datetime,
  "timeZone": string,
  "accessRole": string,
  "defaultReminders": [
    {
      "method": string,
      "minutes": integer
    }
  ],
  "nextPageToken": string,
  "nextSyncToken": string,
  "items": [
    events Resource
  ]
}

But in addition to the expected dictionary keys and values I get information in tuples. eg.:

('kind', 'calendar#event'), ('etag', '"3306952077924000"'), ('id', '5qcpuj5r1k35v533slhljtgh9g'), ('status', 'confirmed')

This second thing kind of makes sense. I have more than the baseline information in the event, so there is more info adde but since it is more than expected it gets added into tuples.

It really is the first issue of getting events outside scope that bothers me. The second issue is just hunch that the two things could be related.

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

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

发布评论

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

评论(1

我们的影子 2025-02-18 19:21:18

我将回答标题问题:

对于事件['items']中的事件:正在通过事件进行循环,其中事件是指定的此处

event.items()返回键值对的列表作为元组。没有额外的信息。

I'll answer the title question:

for event in events['items']: is looping through the events, where events is a dict specified here

event.items() returns a list of key value pairs as tuples. There is no extra information.

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