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

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: 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
Index: tools/findit/crash_utils.py
diff --git a/tools/findit/crash_utils.py b/tools/findit/crash_utils.py
index a1bafe6af87569db3b76957923011dccc194d1a2..3a75fa49bf8f001f013a69f30662e166662af3a4 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
@@ -196,23 +197,19 @@ def GetDataFromURL(url, retries=10, sleep_time=0.1, timeout=10):
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

Powered by Google App Engine
This is Rietveld 408576698