diff --git a/samples/calendar_api/calendar_sample.py b/samples/calendar_api/calendar_sample.py index 2b791430357..60c7e72ce6a 100644 --- a/samples/calendar_api/calendar_sample.py +++ b/samples/calendar_api/calendar_sample.py @@ -23,25 +23,27 @@ from oauth2client import client from googleapiclient import sample_tools + def main(argv): - # Authenticate and construct service. - service, flags = sample_tools.init( - argv, 'calendar', 'v3', __doc__, __file__, - scope='https://www.googleapis.com/auth/calendar.readonly') - - try: - 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 - - except client.AccessTokenRefreshError: - print ('The credentials have been revoked or expired, please re-run' - 'the application to re-authorize.') + # Authenticate and construct service. + service, flags = sample_tools.init( + argv, 'calendar', 'v3', __doc__, __file__, + scope='https://www.googleapis.com/auth/calendar.readonly') + + try: + 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 + + except client.AccessTokenRefreshError: + print('The credentials have been revoked or expired, please re-run' + 'the application to re-authorize.') if __name__ == '__main__': - main(sys.argv) + main(sys.argv)