calendar#

class platypush.plugins.calendar.CalendarPlugin(calendars=None, *args, **kwargs)[source]#

Bases: Plugin, CalendarInterface

The CalendarPlugin allows you to keep track of multiple calendars (Google or iCal URLs) and get joined events from all of them.

__init__(calendars=None, *args, **kwargs)[source]#
Parameters:

calendars (list) – List of calendars to be queried. Supported types so far: Google Calendar and iCal URLs.

Example format:

calendars = [
    {
        "type": "platypush.plugins.google.calendar.GoogleCalendarPlugin"
    },

    {
        "type": "platypush.plugins.calendar.ical.IcalCalendarPlugin",
        "url": "https://www.facebook.com/ical/u.php?uid=USER_ID&key=FB_KEY"
    },

    ...
]
get_upcoming_events(max_results=10)[source]#

Get a list of upcoming events merging all the available calendars.

Parameters:

max_results (int) – Maximum number of results to be returned (default: 10)

Returns:

platypush.message.Response – Response object with the list of events in the Google calendar API format.

Example:

output = [
    {
        "id": "123456abcdef",
        "kind": "calendar#event",
        "status": "confirmed",
        "htmlLink": "...",
        "created": "2018-06-01T01:23:45.000Z",
        "updated": "2018-06-01T01:23:45.000Z",
        "creator": {
            "email": "...",
            "displayName": "...",
            "self": true
        },
        "organizer" {
            "email": "...",
            "displayName": "...",
            "self": true
        },
        "start": {
            "dateTime": "2018-06-02T10:00:00.000Z",
        },
        "end": {
            "dateTime": "2018-06-02T12:00:00.000Z",
        },
    },
    ...
]