Chromium Code Reviews| Index: third_party/gsutil/oauth2_plugin/oauth2_helper.py |
| diff --git a/third_party/gsutil/oauth2_plugin/oauth2_helper.py b/third_party/gsutil/oauth2_plugin/oauth2_helper.py |
| index 9cf22d264af9baeff5fbc35ed2bf0b0a805d1c66..81695a09e893684a4087e1d16858f8fc39ca53a4 100644 |
| --- a/third_party/gsutil/oauth2_plugin/oauth2_helper.py |
| +++ b/third_party/gsutil/oauth2_plugin/oauth2_helper.py |
| @@ -76,31 +76,12 @@ def OAuth2ClientFromBotoConfig(config): |
| client_id, client_secret, |
| proxy=proxy, access_token_cache=token_cache) |
| -def OAuth2ApprovalFlow(oauth2_client, scopes, launch_browser=False): |
| +def OAuth2ApprovalFlow(oauth2_client, scopes): |
| approval_url = oauth2_client.GetAuthorizationUri(OOB_REDIRECT_URI, scopes) |
| - if launch_browser: |
| - sys.stdout.write( |
| - 'Attempting to launch a browser with the OAuth2 approval dialog at ' |
| - 'URL: %s\n\n' |
| - '[Note: due to a Python bug, you may see a spurious error message "object is not\n' |
| - 'callable [...] in [...] Popen.__del__" which can be ignored.]\n\n' % approval_url) |
| - else: |
| - sys.stdout.write( |
| - 'Please navigate your browser to the following URL:\n%s\n' % |
| - approval_url) |
| - |
| sys.stdout.write( |
|
M-A Ruel
2014/04/02 21:29:43
You could only delete this line and use launch_bro
Ryan Tseng
2014/04/02 22:07:03
Done.
|
| - 'In your browser you should see a page that requests you to authorize ' |
| - 'gsutil to access\nGoogle Cloud Storage on your behalf. After you ' |
| - 'approve, an authorization code will be displayed.\n\n') |
| - if (launch_browser and |
| - not webbrowser.open(approval_url, new=1, autoraise=True)): |
| - sys.stdout.write( |
| - 'Launching browser appears to have failed; please navigate a browser ' |
| - 'to the following URL:\n%s\n' % approval_url) |
| - # Short delay; webbrowser.open on linux insists on printing out a message |
|
M-A Ruel
2014/04/02 21:29:43
and still deleting this sleep() call.
|
| - # which we don't want to run into the prompt for the auth code. |
| - time.sleep(2) |
| + 'Please navigate your browser to the following URL:\n%s\n\n' % |
| + approval_url) |
| + |
| code = raw_input('Enter the authorization code: ') |
| refresh_token, access_token = oauth2_client.ExchangeAuthorizationCode( |