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':
|
||||
import urllib
|
||||
import urlparse
|
||||
urlopen = urllib.urlopen
|
||||
urlparse = urlparse.urlparse
|
||||
else:
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
urlopen = urllib.request.urlopen
|
||||
urlparse = urllib.parse.urlparse
|
||||
|
||||
import fixtures
|
||||
import requests
|
||||
import testtools
|
||||
from testtools import content
|
||||
|
||||
@ -60,8 +59,10 @@ class GerritHelpers(object):
|
||||
|
||||
if not os.path.exists(self.gerrit_war):
|
||||
print("Downloading Gerrit binary from %s..." % WAR_URL)
|
||||
resp = urlopen(WAR_URL)
|
||||
utils.write_to_file(self.gerrit_war, resp.read())
|
||||
resp = requests.get(WAR_URL)
|
||||
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)
|
||||
|
||||
def init_gerrit(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user