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

Unified Diff: tools/findit/common/http_client_local.py

Issue 504443004: [Findit] Improve output format and cherry-pick bugs fix. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nit. Created 6 years, 4 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 | « tools/findit/chromium_deps_unittest.py ('k') | tools/findit/common/utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/findit/common/http_client_local.py
diff --git a/tools/findit/common/http_client_local.py b/tools/findit/common/http_client_local.py
index bf386f9a3968ddbc183ca3687ac570d2bbff9f56..fccb0b60266b44fe1300a6d77e78b195685ab671 100644
--- a/tools/findit/common/http_client_local.py
+++ b/tools/findit/common/http_client_local.py
@@ -205,11 +205,20 @@ def _SendRequest(url, timeout=None):
urllib2.HTTPCookieProcessor(cookielib.MozillaCookieJar(cookie_file)))
url_opener = urllib2.build_opener(*handlers)
- if timeout is not None:
+
+ status_code = None
+ content = None
+
+ try:
response = url_opener.open(url, timeout=timeout)
- else:
- response = url_opener.open(url)
- return response.code, response.read()
+
+ status_code = response.code
+ content = response.read()
+ except urllib2.HTTPError as e:
+ status_code = e.code
+ content = None
+
+ return status_code, content
class HttpClientLocal(http_client.HttpClient):
« no previous file with comments | « tools/findit/chromium_deps_unittest.py ('k') | tools/findit/common/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698