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

Unified Diff: tools/findit/crash_utils.py

Issue 465403004: [Findit] Support sending cookies for http requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. 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/common/utils.py ('k') | tools/findit/https.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/findit/crash_utils.py
diff --git a/tools/findit/crash_utils.py b/tools/findit/crash_utils.py
index c3cc1a5e8593715e52ac7c39cf303a77cd0b20d8..42a17ce2cb341e7e4202a8a4aaef8261ee52e6ea 100644
--- a/tools/findit/crash_utils.py
+++ b/tools/findit/crash_utils.py
@@ -10,6 +10,7 @@ import os
import time
import urllib2
+from common import utils
from result import Result
@@ -195,23 +196,19 @@ def GetDataFromURL(url, retries=10, sleep_time=0.1, timeout=5):
Returns:
None if the data retrieval fails, or the raw data.
"""
- data = None
- for i in range(retries):
+ count = 0
+ while True:
+ count += 1
# Retrieves data from URL.
try:
- data = urllib2.urlopen(url, timeout=timeout)
-
- # If retrieval is successful, return the data.
- if data:
- return data.read()
-
- # If retrieval fails, try after sleep_time second.
- except urllib2.URLError:
- time.sleep(sleep_time)
- continue
+ _, data = utils.GetHttpClient().Get(url)
+ return data
except IOError:
- time.sleep(sleep_time)
- continue
+ if count < retries:
+ # If retrieval fails, try after sleep_time second.
+ time.sleep(sleep_time)
+ else:
+ break
# Return None if it fails to read data from URL 'retries' times.
return None
« no previous file with comments | « tools/findit/common/utils.py ('k') | tools/findit/https.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698