Merge pull request #192 from danielquinn/patch-1
pep8 + print statement alignment
diff --git a/samples/calendar_api/calendar_sample.py b/samples/calendar_api/calendar_sample.py
index 2b79143..60c7e72 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')
+ # 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
+ 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.')
+ 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)