Changeset 72635 in vbox for trunk/src/VBox/ValidationKit/common
- Timestamp:
- Jun 20, 2018 4:39:17 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/common/webutils.py
r72633 r72635 38 38 from urllib2 import quote as urllib_quote; # pylint: disable=import-error,no-name-in-module 39 39 from urllib import urlencode as urllib_urlencode; # pylint: disable=import-error,no-name-in-module 40 from urllib import urlopen as urllib_urlopen; # pylint: disable=import-error,no-name-in-module 40 from urllib2 import ProxyHandler as urllib_ProxyHandler; # pylint: disable=import-error,no-name-in-module 41 from urllib2 import build_opener as urllib_build_opener; # pylint: disable=import-error,no-name-in-module 41 42 else: 42 43 from urllib.parse import quote as urllib_quote; # pylint: disable=import-error,no-name-in-module 43 44 from urllib.parse import urlencode as urllib_urlencode; # pylint: disable=import-error,no-name-in-module 44 from urllib.request import urlopen as urllib_urlopen;# pylint: disable=import-error,no-name-in-module45 import urllib.request;# pylint: disable=import-error,no-name-in-module45 from urllib.request import ProxyHandler as urllib_ProxyHandler; # pylint: disable=import-error,no-name-in-module 46 from urllib.request import build_opener as urllib_build_opener; # pylint: disable=import-error,no-name-in-module 46 47 47 48 # Validation Kit imports. … … 160 161 ## @todo We get 404.html content instead of exceptions here, which is confusing and should be addressed. 161 162 if not fNoProxies: 162 oSrc = urllib_urlopen(sUrlFile); 163 elif sys.version_info[0] < 3: 164 oSrc = urllib_urlopen(sUrlFile, proxies = dict()); 163 oOpener = urllib_build_opener(); 165 164 else: 166 oProxyHandler = urllib.request.ProxyHandler(proxies = dict()); # pylint: disable=no-member 167 oOpener = urllib.request.build_opener(oProxyHandler) # pylint: disable=no-member 168 oSrc = oOpener.open(sUrlFile); 165 oOpener = urllib_build_opener(urllib_ProxyHandler(proxies = dict())); 166 oSrc = oOpener.open(sUrlFile); 169 167 oDst = utils.openNoInherit(sDstFile, 'wb'); 170 168 oDst.write(oSrc.read());
Note:
See TracChangeset
for help on using the changeset viewer.