Создайте список доступных временных интервалов из Календаря Google

Я ищу программу (Windows 7), расширение Google Chrome или скрипт, который может просматривать мой Календарь Google и генерировать список временных интервалов, когда я буду доступен в течение следующих X дней, например:

  • Понедельник, 13 апреля, с 10:00 до 13:00.
  • Понедельник, 13 апреля, в любое время после 15:00.
  • Вторник, 14 апреля, в любое время после 13:00.
  • Среда, 15 апреля, с 10:00 до 13:00.
  • Среда, 15 апреля, в любое время после 15:00.
  • Пятница, 17 апреля, в любое время после 11:30.
  • Понедельник, 20 апреля с 10:00 до 13:00
  • Понедельник, 20 апреля, в любое время после 15:00.
  • Вторник, 21 апреля, в любое время после 13:00.
  • Среда, 22 апреля, с 10:00 до 13:00.
  • Среда, 22 апреля, в любое время после 15:00.
  • Пятница, 24 апреля, в любое время после 11:30.
  • и т.п.

Ответы (1)

С python плюс API календаря Google вы можете использовать этот calendar.freebusy.queryметод. Это также можно использовать из Google App Engine, и вы можете найти дополнительную информацию здесь .

Это возвращает возвращает: Объект формы:

{
"timeMax": "A String", # The end of the interval.
"kind": "calendar#freeBusy", # Type of the resource ("calendar#freeBusy").
"calendars": { # List of free/busy information for calendars.
  "a_key": { # Free/busy expansions for a single calendar.
    "busy": [ # List of time ranges during which this calendar should be regarded as busy.
      {
        "start": "A String", # The (inclusive) start of the time period.
        "end": "A String", # The (exclusive) end of the time period.
      },
    ],
    "errors": [ # Optional error(s) (if computation for the calendar failed).
      {
        "domain": "A String", # Domain, or broad category, of the error.
        "reason": "A String", # Specific reason for the error. Some of the possible values are:
            # - "groupTooBig" - The group of users requested is too large for a single query.
            # - "tooManyCalendarsRequested" - The number of calendars requested is too large for a single query.
            # - "notFound" - The requested resource was not found.
            # - "internalError" - The API service has encountered an internal error.  Additional error types may be added in the future, so clients should gracefully handle additional error statuses not included in this list.
      },
    ],
  },
},
"groups": { # Expansion of groups.
  "a_key": { # List of calendars that are members of this group.
    "errors": [ # Optional error(s) (if computation for the group failed).
      {
        "domain": "A String", # Domain, or broad category, of the error.
        "reason": "A String", # Specific reason for the error. Some of the possible values are:
            # - "groupTooBig" - The group of users requested is too large for a single query.
            # - "tooManyCalendarsRequested" - The number of calendars requested is too large for a single query.
            # - "notFound" - The requested resource was not found.
            # - "internalError" - The API service has encountered an internal error.  Additional error types may be added in the future, so clients should gracefully handle additional error statuses not included in this list.
      },
    ],
    "calendars": [ # List of calendars' identifiers within a group.
      "A String",
    ],
  },
},
"timeMin": "A String", # The start of the interval.

}

Это должно быть просто в использовании для создания того, что вам нужно.

Вы можете поиграть в API Explorer , просто не забудьте включить переключатель OAuth.

Обратите внимание, что минимальные параметры:

{ "timeMin": "2015-01-01T00:00:00Z" "timeMax": "2015-02-01T00:00:00Z" }