Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: third_party/gsutil/oauth2_plugin/oauth2_helper.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2011 Google Inc. 1 # Copyright 2011 Google Inc.
2 # 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at 5 # You may obtain a copy of the License at
6 # 6 #
7 # http://www.apache.org/licenses/LICENSE-2.0 7 # http://www.apache.org/licenses/LICENSE-2.0
8 # 8 #
9 # Unless required by applicable law or agreed to in writing, software 9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, 10 # distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 'URL: %s\n\n' 84 'URL: %s\n\n'
85 '[Note: due to a Python bug, you may see a spurious error message "objec t is not\n' 85 '[Note: due to a Python bug, you may see a spurious error message "objec t is not\n'
86 'callable [...] in [...] Popen.__del__" which can be ignored.]\n\n' % ap proval_url) 86 'callable [...] in [...] Popen.__del__" which can be ignored.]\n\n' % ap proval_url)
87 else: 87 else:
88 sys.stdout.write( 88 sys.stdout.write(
89 'Please navigate your browser to the following URL:\n%s\n' % 89 'Please navigate your browser to the following URL:\n%s\n' %
90 approval_url) 90 approval_url)
91 91
92 sys.stdout.write( 92 sys.stdout.write(
93 'In your browser you should see a page that requests you to authorize ' 93 'In your browser you should see a page that requests you to authorize '
94 'gsutil to access\nGoogle Storage on your behalf. After you approve, an ' 94 'gsutil to access\nGoogle Cloud Storage on your behalf. After you '
95 'authorization code will be displayed.\n\n') 95 'approve, an authorization code will be displayed.\n\n')
96 if (launch_browser and 96 if (launch_browser and
97 not webbrowser.open(approval_url, new=1, autoraise=True)): 97 not webbrowser.open(approval_url, new=1, autoraise=True)):
98 sys.stdout.write( 98 sys.stdout.write(
99 'Launching browser appears to have failed; please navigate a browser ' 99 'Launching browser appears to have failed; please navigate a browser '
100 'to the following URL:\n%s\n' % approval_url) 100 'to the following URL:\n%s\n' % approval_url)
101 # Short delay; webbrowser.open on linux insists on printing out a message 101 # Short delay; webbrowser.open on linux insists on printing out a message
102 # which we don't want to run into the prompt for the auth code. 102 # which we don't want to run into the prompt for the auth code.
103 time.sleep(2) 103 time.sleep(2)
104 code = raw_input('Enter the authorization code: ') 104 code = raw_input('Enter the authorization code: ')
105 105
106 refresh_token, access_token = oauth2_client.ExchangeAuthorizationCode( 106 refresh_token, access_token = oauth2_client.ExchangeAuthorizationCode(
107 code, OOB_REDIRECT_URI, scopes) 107 code, OOB_REDIRECT_URI, scopes)
108 108
109 return refresh_token 109 return refresh_token
110 110
OLDNEW
« no previous file with comments | « third_party/gsutil/oauth2_plugin/oauth2_client_test.py ('k') | third_party/gsutil/oauth2_plugin/oauth2_plugin.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698