Merge "Switch to requests to support proxying of 'https'"

This commit is contained in:
Jenkins 2015-06-12 15:16:04 +00:00 committed by Gerrit Code Review
commit 5df45d4fd2

@ -21,15 +21,14 @@ import sys
if sys.version < '3': if sys.version < '3':
import urllib import urllib
import urlparse import urlparse
urlopen = urllib.urlopen
urlparse = urlparse.urlparse urlparse = urlparse.urlparse
else: else:
import urllib.parse import urllib.parse
import urllib.request import urllib.request
urlopen = urllib.request.urlopen
urlparse = urllib.parse.urlparse urlparse = urllib.parse.urlparse
import fixtures import fixtures
import requests
import testtools import testtools
from testtools import content from testtools import content
@ -60,8 +59,10 @@ class GerritHelpers(object):
if not os.path.exists(self.gerrit_war): if not os.path.exists(self.gerrit_war):
print("Downloading Gerrit binary from %s..." % WAR_URL) print("Downloading Gerrit binary from %s..." % WAR_URL)
resp = urlopen(WAR_URL) resp = requests.get(WAR_URL)
utils.write_to_file(self.gerrit_war, resp.read()) if resp.status_code != 200:
raise RuntimeError("Problem requesting Gerrit war")
utils.write_to_file(self.gerrit_war, resp.content)
print("Saved to %s" % self.gerrit_war) print("Saved to %s" % self.gerrit_war)
def init_gerrit(self): def init_gerrit(self):