Skip to content

Commit fb4f522

Browse files
authored
Update main.py
Update to follow proper linting/style by using `six` library, because it is against standards to redefine builtin `input()`
1 parent fa62ec8 commit fb4f522

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drive/driveapp/main.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@
66
"""
77

88
from __future__ import print_function
9+
import six
910
import pprint
1011
import httplib2
1112
from googleapiclient.discovery import build
1213
import googleapiclient.http
1314
import oauth2client.client
1415

15-
#Add user input support for both Python2 and Python3
16-
try:
17-
input = raw_input # Python2
18-
except:
19-
pass # Python3
20-
2116
# OAuth 2.0 scope that will be authorized.
2217
# Check https://developers.google.com/drive/scopes for all available scopes.
2318
OAUTH2_SCOPE = 'https://www.googleapis.com/auth/drive'
@@ -38,8 +33,8 @@
3833
flow.redirect_uri = oauth2client.client.OOB_CALLBACK_URN
3934
authorize_url = flow.step1_get_authorize_url()
4035
print('Go to the following link in your browser: ' + authorize_url)
41-
# If you can't use Python 3.x, please change "input" to "raw_input"
42-
code = input('Enter verification code: ').strip()
36+
# Add user input support for both Python2 and Python3
37+
code = six.moves.input('Enter verification code: ').strip()
4338
credentials = flow.step2_exchange(code)
4439

4540
# Create an authorized Drive API client.

0 commit comments

Comments
 (0)