Skip to content

Commit d0cb821

Browse files
committed
Merge pull request googleapis#121 from maxwell-k/master
Use six to call raw_input for Python 3 support
2 parents 26d6429 + 1fc21c4 commit d0cb821

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

oauth2client/old_run.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import webbrowser
2424

2525
import gflags
26+
from six.moves import input
2627

2728
from oauth2client import client
2829
from oauth2client import util
@@ -147,7 +148,7 @@ def run(flow, storage, http=None):
147148
print('Failed to find "code" in the query parameters of the redirect.')
148149
sys.exit('Try running with --noauth_local_webserver.')
149150
else:
150-
code = raw_input('Enter verification code: ').strip()
151+
code = input('Enter verification code: ').strip()
151152

152153
try:
153154
credential = flow.step2_exchange(code, http=http)

oauth2client/tools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
from six.moves import BaseHTTPServer
3232
from six.moves import urllib
33+
from six.moves import input
3334

3435
from oauth2client import client
3536
from oauth2client import util
@@ -216,7 +217,7 @@ def run_flow(flow, storage, flags, http=None):
216217
print('Failed to find "code" in the query parameters of the redirect.')
217218
sys.exit('Try running with --noauth_local_webserver.')
218219
else:
219-
code = raw_input('Enter verification code: ').strip()
220+
code = input('Enter verification code: ').strip()
220221

221222
try:
222223
credential = flow.step2_exchange(code, http=http)

samples/oauth2_for_devices.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# See: https://developers.google.com/accounts/docs/OAuth2ForDevices
44

55
import httplib2
6+
from six.moves import input
67
from oauth2client.client import OAuth2WebServerFlow
78
from googleapiclient.discovery import build
89

@@ -18,7 +19,7 @@
1819
print "Enter the following code at %s: %s" % (flow_info.verification_url,
1920
flow_info.user_code)
2021
print "Then press Enter."
21-
raw_input()
22+
input()
2223

2324
# Step 2: get credentials
2425
# https://developers.google.com/accounts/docs/OAuth2ForDevices#obtainingatoken

0 commit comments

Comments
 (0)