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

Unified Diff: appengine/findit/common/http_client_appengine.py

Issue 2079773004: [Findit] Add a Rietveld client to post a message to codereview of a culprit. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix unittests. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/findit/common/codereview.py ('k') | appengine/findit/common/rietveld.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/common/http_client_appengine.py
diff --git a/appengine/findit/common/http_client_appengine.py b/appengine/findit/common/http_client_appengine.py
index ed8b5fc538b80ae1260aa563b0c2f913ee6e72af..aabcb16dd4e7892c794159d5819cce9b4c467844 100644
--- a/appengine/findit/common/http_client_appengine.py
+++ b/appengine/findit/common/http_client_appengine.py
@@ -11,10 +11,12 @@ from common import auth_util
from common.retry_http_client import RetryHttpClient
-#TODO(katesonia): Move this to config.
+# TODO(katesonia): Move this to config.
_INTERNAL_HOSTS_TO_SCOPES = {
'https://chrome-internal.googlesource.com/': (
- 'https://www.googleapis.com/auth/gerritcodereview')
+ 'https://www.googleapis.com/auth/gerritcodereview'),
+ 'https://codereview.chromium.org/': (
+ 'https://www.googleapis.com/auth/userinfo.email'),
}
@@ -39,15 +41,18 @@ class HttpClientAppengine(RetryHttpClient): # pragma: no cover
for host, scope in _INTERNAL_HOSTS_TO_SCOPES.iteritems():
if url.startswith(host):
self._ExpandAuthorizationHeaders(headers, scope)
+ logging.debug('Authorization header of scope %s was added for %s',
+ scope, url)
break
if method in (urlfetch.POST, urlfetch.PUT):
result = urlfetch.fetch(
- url, payload=data, method=method,
- headers=headers, deadline=timeout, validate_certificate=True)
+ url, payload=data, method=method, headers=headers, deadline=timeout,
+ follow_redirects=False, validate_certificate=True)
else:
result = urlfetch.fetch(
- url, headers=headers, deadline=timeout, validate_certificate=True)
+ url, headers=headers, deadline=timeout,
+ follow_redirects=False, validate_certificate=True)
if (result.status_code != 200 and self._ShouldLogError(result.status_code)):
logging.error('Request to %s resulted in %d, headers:%s', url,
« no previous file with comments | « appengine/findit/common/codereview.py ('k') | appengine/findit/common/rietveld.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698