OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import json | 5 import json |
6 import logging | 6 import logging |
7 | 7 |
8 from google.appengine.api import urlfetch | 8 from google.appengine.api import urlfetch |
9 | 9 |
10 from common import auth_util | 10 from common import auth_util |
11 from common.retry_http_client import RetryHttpClient | 11 from libs.http.retry_http_client import RetryHttpClient |
12 | 12 |
13 | 13 |
14 # TODO(katesonia): Move this to config. | 14 # TODO(katesonia): Move this to config. |
15 _INTERNAL_HOSTS_TO_SCOPES = { | 15 _INTERNAL_HOSTS_TO_SCOPES = { |
16 'https://chrome-internal.googlesource.com/': ( | 16 'https://chrome-internal.googlesource.com/': ( |
17 'https://www.googleapis.com/auth/gerritcodereview'), | 17 'https://www.googleapis.com/auth/gerritcodereview'), |
18 'https://codereview.chromium.org/': ( | 18 'https://codereview.chromium.org/': ( |
19 'https://www.googleapis.com/auth/userinfo.email'), | 19 'https://www.googleapis.com/auth/userinfo.email'), |
20 } | 20 } |
21 | 21 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return result.status_code, result.content | 65 return result.status_code, result.content |
66 | 66 |
67 def _Get(self, url, timeout, headers): | 67 def _Get(self, url, timeout, headers): |
68 return self._SendRequest(url, urlfetch.GET, None, timeout, headers) | 68 return self._SendRequest(url, urlfetch.GET, None, timeout, headers) |
69 | 69 |
70 def _Post(self, url, data, timeout, headers): | 70 def _Post(self, url, data, timeout, headers): |
71 return self._SendRequest(url, urlfetch.POST, data, timeout, headers) | 71 return self._SendRequest(url, urlfetch.POST, data, timeout, headers) |
72 | 72 |
73 def _Put(self, url, data, timeout, headers): | 73 def _Put(self, url, data, timeout, headers): |
74 return self._SendRequest(url, urlfetch.PUT, data, timeout, headers) | 74 return self._SendRequest(url, urlfetch.PUT, data, timeout, headers) |
OLD | NEW |