From f70585cd88a74477c12599b8dbd28736d8e75a32 Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Wed, 26 Sep 2018 20:49:36 -0500 Subject: [PATCH] added body example, converted `while True` loops to do whiles --- calendar_api.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/calendar_api.py b/calendar_api.py index a0ef249..8358e23 100644 --- a/calendar_api.py +++ b/calendar_api.py @@ -16,6 +16,21 @@ def dateTime(datetime): "dateTime":datetime, } +#~~BODY EXAMPLE~~# +# {'attendees': [{'email': 'lpage@example.com'}, +# {'email': 'sbrin@example.com'}], +# 'description': "A chance to hear more about Google's developer products.", +# 'end': {'dateTime': '2015-05-28T17:00:00-07:00', +# 'timeZone': 'America/Los_Angeles'}, +# 'location': '800 Howard St., San Francisco, CA 94103', +# 'recurrence': ['RRULE:FREQ=DAILY;COUNT=2'], +# 'reminders': {'overrides': [{'method': 'email', 'minutes': 1440}, +# {'method': 'popup', 'minutes': 10}], +# 'useDefault': False}, +# 'start': {'dateTime': '2015-05-28T09:00:00-07:00', +# 'timeZone': 'America/Los_Angeles'}, +# 'summary': 'Google I/O 2015'} + class calendar_api(API): def __init__( self, @@ -59,12 +74,12 @@ class calendar_api(API): def get_calendars(self): page_token = None cl = [] - while True: + first = True + while page_token or first: + first = False calendar_list = self.service.calendarList().list(pageToken=page_token).execute() cl += list(calendar_list_entry for calendar_list_entry in calendar_list['items']) page_token = calendar_list.get('nextPageToken') - if not page_token: - break return cl def get_events(self,id): @@ -83,4 +98,4 @@ class calendar_api(API): break return ret if __name__ == "__main__": - my_api = calendar_api(APPLICATION_NAME,'test\\client_secret.json','test') \ No newline at end of file + my_api = calendar_api(APPLICATION_NAME,r'test\calendar\client_secret.json','test\calendar') \ No newline at end of file