|
|
@ -23,7 +23,8 @@ class calendar_api(API): |
|
|
|
|
|
|
|
|
self.calendars = self.get_calendars() |
|
|
self.calendars = self.get_calendars() |
|
|
self.ids = dict( |
|
|
self.ids = dict( |
|
|
(calendar["summary"].lower(), calendar["id"]) for calendar in self.calendars |
|
|
|
|
|
|
|
|
(calendar["summary"].lower(), calendar["id"]) |
|
|
|
|
|
for calendar in self.calendars.values() |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def create_event(self, calendar_id, body): |
|
|
def create_event(self, calendar_id, body): |
|
|
@ -62,13 +63,14 @@ class calendar_api(API): |
|
|
|
|
|
|
|
|
def get_calendars(self): |
|
|
def get_calendars(self): |
|
|
page_token = None |
|
|
page_token = None |
|
|
cl = [] |
|
|
|
|
|
|
|
|
cl = {} |
|
|
first = True |
|
|
first = True |
|
|
while page_token or first: |
|
|
while page_token or first: |
|
|
first = False |
|
|
first = False |
|
|
calendar_list_service = self.service.calendarList() |
|
|
calendar_list_service = self.service.calendarList() |
|
|
calendar_list = calendar_list_service.list(pageToken=page_token).execute() |
|
|
calendar_list = calendar_list_service.list(pageToken=page_token).execute() |
|
|
cl += list(calendar_entry for calendar_entry in calendar_list["items"]) |
|
|
|
|
|
|
|
|
for calendar_entry in calendar_list["items"]: |
|
|
|
|
|
cl[calendar_entry["id"]] = calendar_entry |
|
|
page_token = calendar_list.get("nextPageToken") |
|
|
page_token = calendar_list.get("nextPageToken") |
|
|
return cl |
|
|
return cl |
|
|
|
|
|
|
|
|
|