Skip to content

Commit b245f84

Browse files
author
Eric Koleda
authored
Merge pull request googleworkspace#71 from rmccorm4/patch-2
Update main.py for Python2 and Python3 user input support
2 parents 0a5296c + d37d8bb commit b245f84

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drive/driveapp/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from __future__ import print_function
99
import pprint
10+
import six
1011
import httplib2
1112
from googleapiclient.discovery import build
1213
import googleapiclient.http
@@ -32,8 +33,8 @@
3233
flow.redirect_uri = oauth2client.client.OOB_CALLBACK_URN
3334
authorize_url = flow.step1_get_authorize_url()
3435
print('Go to the following link in your browser: ' + authorize_url)
35-
# If you can't use Python 3.x, please change "input" to "raw_input"
36-
code = input('Enter verification code: ').strip()
36+
# `six` library supports Python2 and Python3 without redefining builtin input()
37+
code = six.moves.input('Enter verification code: ').strip()
3738
credentials = flow.step2_exchange(code)
3839

3940
# Create an authorized Drive API client.

0 commit comments

Comments
 (0)