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

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: 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
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..a8fbb841ef3df4e5f2e840079828b07589c7d42d 100644
--- a/appengine/findit/common/http_client_appengine.py
+++ b/appengine/findit/common/http_client_appengine.py
@@ -14,7 +14,9 @@ from common.retry_http_client import RetryHttpClient
#TODO(katesonia): Move this to config.
lijeffrey 2016/06/21 17:42:52 nit: add a space after # to keep pylint from compl
stgao 2016/06/24 04:24:51 Done.
_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,

Powered by Google App Engine
This is Rietveld 408576698