Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a4ddf95

Browse files
committed
pep8 + print statement alignment
The original: * Violated pep8 * Used `print()` both as a statement and as a function, guaranteeing that the code won't work in either Python 2.5 or 3.x * Didn't explain anything about what was happening. This change fixes two of those problems.
1 parent e2fd7cb commit a4ddf95

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

samples/calendar_api/calendar_sample.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# you may not use this file except in compliance with the License.
88
# You may obtain a copy of the License at
99
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
10+
# http://www.apache.org/licenses/LICENSE-2.0
1111
#
1212
# Unless required by applicable law or agreed to in writing, software
1313
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,25 +23,27 @@
2323
from oauth2client import client
2424
from googleapiclient import sample_tools
2525

26+
2627
def main(argv):
27-
# Authenticate and construct service.
28-
service, flags = sample_tools.init(
29-
argv, 'calendar', 'v3', __doc__, __file__,
30-
scope='https://www.googleapis.com/auth/calendar.readonly')
31-
32-
try:
33-
page_token = None
34-
while True:
35-
calendar_list = service.calendarList().list(pageToken=page_token).execute()
36-
for calendar_list_entry in calendar_list['items']:
37-
print calendar_list_entry['summary']
38-
page_token = calendar_list.get('nextPageToken')
39-
if not page_token:
40-
break
41-
42-
except client.AccessTokenRefreshError:
43-
print ('The credentials have been revoked or expired, please re-run'
44-
'the application to re-authorize.')
28+
# Authenticate and construct service.
29+
service, flags = sample_tools.init(
30+
argv, 'calendar', 'v3', __doc__, __file__,
31+
scope='https://www.googleapis.com/auth/calendar.readonly')
32+
33+
try:
34+
page_token = None
35+
while True:
36+
calendar_list = service.calendarList().list(
37+
pageToken=page_token).execute()
38+
for calendar_list_entry in calendar_list['items']:
39+
print(calendar_list_entry['summary'])
40+
page_token = calendar_list.get('nextPageToken')
41+
if not page_token:
42+
break
43+
44+
except client.AccessTokenRefreshError:
45+
print('The credentials have been revoked or expired, please re-run'
46+
'the application to re-authorize.')
4547

4648
if __name__ == '__main__':
47-
main(sys.argv)
49+
main(sys.argv)

0 commit comments

Comments
 (0)