From cfa2540c90fd7ae5f190e48c6c9bdf898170f478 Mon Sep 17 00:00:00 2001 From: raphael Date: Wed, 11 Mar 2020 00:05:34 +0100 Subject: [PATCH] adds printing color id from calendars and events --- quickstart.py | 11 +++++++---- token.pickle | Bin 752 -> 752 bytes 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/quickstart.py b/quickstart.py index 54c1529..bd95daf 100644 --- a/quickstart.py +++ b/quickstart.py @@ -40,6 +40,7 @@ def getCalendarEvents(service, startDate, endDate): while True: calendar_list = service.calendarList().list(pageToken=page_token).execute() for calendar_list_entry in calendar_list['items']: + print(calendar_list_entry['colorId']) calendar_ids.append(calendar_list_entry['id']) page_token = calendar_list.get('nextPageToken') if not page_token: @@ -63,8 +64,8 @@ def main(): now = datetime.datetime.now() now = now.replace(hour=00, minute=00) today = now.isoformat() + 'Z' # 'Z' indicates UTC time - one_day = datetime.timedelta(days=1) - tomorrow = (now + one_day).isoformat() + 'Z' + # one_day = datetime.timedelta(days=1) + tomorrow = (now.replace(hour=23, minute=59, second=59)).isoformat() + 'Z' all_events = getCalendarEvents(service, today, tomorrow) @@ -72,8 +73,10 @@ def main(): # print('No upcoming events found.') for event_list in all_events: for event in event_list: - start = event['start'].get('dateTime', event['start'].get('date')) - print(start, event['summary']) + start = event['start'].get('dateTime') + color = event.get('colorId') + end = event['end'].get('dateTime') + print(start, " ", end, color, event['summary']) if __name__ == '__main__': diff --git a/token.pickle b/token.pickle index 84c4373e592cf5b4ed7bbc0033010e45d00f5841..76117d905f5448af93ebd6d4f38976a691bc7afe 100644 GIT binary patch delta 181 zcmeys`hj&qP<>8PWKwFFub+Woa!N#KP?%eAVwsyqhL@33hIv_#pRZA3x_eT*ZiY#^ zMR7&2ZisPdh+A?{QHq6oaf+pPXsC(1hlzz@Xo-hKX-2A{(h?8M*fJ>s6p`3A)u5pP`dPGXFZdhqzU|B$D ha=uf!nTdOpLApWZ#P^!)T;k?p?EGn)n zd|6&#S*mYUNnoLwpSMY2vXg7RrGJ=TQE6JZX{vFiL19vMQc0GFsc%w7X?bvdXjMs` zVX?1|hj(^xaDY>ai$SSZsas(|plOwENtjnyiI=gPg