Browse Source

added body example, converted `while True` loops to do whiles

event_class
Raphael Roberts 7 years ago
parent
commit
f70585cd88
  1. 23
      calendar_api.py

23
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')
my_api = calendar_api(APPLICATION_NAME,r'test\calendar\client_secret.json','test\calendar')
Loading…
Cancel
Save