Switch to requests to support proxying of 'https'
Convert to using the requests module which supports proxying of 'https' connections for retriving the gerrit war file when behind a corporate proxy. Change-Id: Id368cb6aa7058970ad6ac10caacea2aec9bfe48b
This commit is contained in:
parent
a13b7a9d77
commit
48d6059a5f
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue