1

How can I retrieve the calendar ID of various calendars on my google calendar by using the API, I am aware that using the

page_token = None
while True:
  calendar_list = service.calendarList().list(pageToken=page_token).execute()
  for calendar_list_entry in calendar_list['items']:
    print calendar_list_entry['summary']
  page_token = calendar_list.get('nextPageToken')
  if not page_token:
    break

It will return the name but I would like to get it to return the CalendarId

1 Answer 1

1

google API calendarList resource representation

You could just print out the entry itself, instead of a single key.

page_token = None
while True:
  calendar_list = service.calendarList().list(pageToken=page_token).execute()
  for calendar_list_entry in calendar_list['items']:
    print calendar_list_entry
  page_token = calendar_list.get('nextPageToken')
  if not page_token:
    break

Or directly get the id:

print calendar_list_entry["id"]
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you that is exactly what I needed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.