Fix python3 Compatibility for urllib2
The urllib2 module has been split across several modules in Python 3 named urllib.request and urllib.error [1]. This patch makes code compatible for both python2 and python3 by using six.moves.urllib [2]. [1] https://docs.python.org/2/library/urllib2.html [2] https://pythonhosted.org/six/ Change-Id: Ie9ebe0d1e39ddb4704df067d42915204e49821cf Closes-Bug: #1809801
This commit is contained in:
parent
ae006e683b
commit
42bce570ca
|
@ -15,9 +15,9 @@
|
|||
|
||||
import os
|
||||
import six
|
||||
from six.moves.urllib.request import urlopen
|
||||
import sys
|
||||
import time
|
||||
import urllib2
|
||||
|
||||
from lxml import etree
|
||||
from oslo_log import log
|
||||
|
@ -83,7 +83,7 @@ class VpnTest(scenario_base.BaseScenarioTest):
|
|||
def test_vpn_connectivity(self):
|
||||
is_amazon = 'amazon' in CONF.aws.ec2_url
|
||||
|
||||
response = urllib2.urlopen(self.OPENSWAN_LINK, timeout=30)
|
||||
response = urlopen(self.OPENSWAN_LINK, timeout=30)
|
||||
content = response.read()
|
||||
if not is_amazon:
|
||||
# NOTE(andrey-mp): gating in openstack doesn't have internet access
|
||||
|
|
Loading…
Reference in New Issue