adds printing color id from calendars and events
This commit is contained in:
parent
7fd7b69f65
commit
cfa2540c90
@ -40,6 +40,7 @@ def getCalendarEvents(service, startDate, endDate):
|
|||||||
while True:
|
while True:
|
||||||
calendar_list = service.calendarList().list(pageToken=page_token).execute()
|
calendar_list = service.calendarList().list(pageToken=page_token).execute()
|
||||||
for calendar_list_entry in calendar_list['items']:
|
for calendar_list_entry in calendar_list['items']:
|
||||||
|
print(calendar_list_entry['colorId'])
|
||||||
calendar_ids.append(calendar_list_entry['id'])
|
calendar_ids.append(calendar_list_entry['id'])
|
||||||
page_token = calendar_list.get('nextPageToken')
|
page_token = calendar_list.get('nextPageToken')
|
||||||
if not page_token:
|
if not page_token:
|
||||||
@ -63,8 +64,8 @@ def main():
|
|||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
now = now.replace(hour=00, minute=00)
|
now = now.replace(hour=00, minute=00)
|
||||||
today = now.isoformat() + 'Z' # 'Z' indicates UTC time
|
today = now.isoformat() + 'Z' # 'Z' indicates UTC time
|
||||||
one_day = datetime.timedelta(days=1)
|
# one_day = datetime.timedelta(days=1)
|
||||||
tomorrow = (now + one_day).isoformat() + 'Z'
|
tomorrow = (now.replace(hour=23, minute=59, second=59)).isoformat() + 'Z'
|
||||||
|
|
||||||
all_events = getCalendarEvents(service, today, tomorrow)
|
all_events = getCalendarEvents(service, today, tomorrow)
|
||||||
|
|
||||||
@ -72,8 +73,10 @@ def main():
|
|||||||
# print('No upcoming events found.')
|
# print('No upcoming events found.')
|
||||||
for event_list in all_events:
|
for event_list in all_events:
|
||||||
for event in event_list:
|
for event in event_list:
|
||||||
start = event['start'].get('dateTime', event['start'].get('date'))
|
start = event['start'].get('dateTime')
|
||||||
print(start, event['summary'])
|
color = event.get('colorId')
|
||||||
|
end = event['end'].get('dateTime')
|
||||||
|
print(start, " ", end, color, event['summary'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
BIN
token.pickle
BIN
token.pickle
Binary file not shown.
Loading…
Reference in New Issue
Block a user