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

Side by Side Diff: third_party/gsutil/20110627/oauth2_plugin/oauth2_plugin.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
(Empty)
1 from boto.auth_handler import AuthHandler
2 from boto.auth_handler import NotReadyToAuthenticate
3 import oauth2_client
4 import oauth2_helper
5
6 class OAuth2Auth(AuthHandler):
7
8 capability = ['google-oauth2', 's3']
9
10 def __init__(self, path, config, provider):
11 if (provider.name == 'google'
12 and config.has_option('Credentials', 'gs_oauth2_refresh_token')):
13
14 self.oauth2_client = oauth2_helper.OAuth2ClientFromBotoConfig(config)
15
16 self.refresh_token = oauth2_client.RefreshToken(
17 self.oauth2_client,
18 config.get('Credentials', 'gs_oauth2_refresh_token'))
19 else:
20 raise NotReadyToAuthenticate()
21
22 def add_auth(self, http_request):
23 http_request.headers['Authorization'] = \
24 self.refresh_token.GetAuthorizationHeader()
OLDNEW
« no previous file with comments | « third_party/gsutil/20110627/oauth2_plugin/oauth2_helper.py ('k') | third_party/gsutil/20110627/third_party/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698