mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Removed HTTP(S) proxy code
The HTTP(S) proxy is now set globally from the configuration logic.
This commit is contained in:
parent
14e5c490e6
commit
c211c60e52
@ -57,7 +57,6 @@ if minisix.PY2:
|
|||||||
return urllib.urlencode(*args, **kwargs).encode()
|
return urllib.urlencode(*args, **kwargs).encode()
|
||||||
from urllib2 import HTTPError, URLError
|
from urllib2 import HTTPError, URLError
|
||||||
from urllib import splithost, splituser
|
from urllib import splithost, splituser
|
||||||
from urllib2 import build_opener, install_opener, ProxyHandler
|
|
||||||
else:
|
else:
|
||||||
from http.client import InvalidURL
|
from http.client import InvalidURL
|
||||||
from urllib.parse import urlsplit, urlunsplit, urlparse
|
from urllib.parse import urlsplit, urlunsplit, urlparse
|
||||||
@ -73,7 +72,6 @@ else:
|
|||||||
return urllib.parse.urlencode(*args, **kwargs)
|
return urllib.parse.urlencode(*args, **kwargs)
|
||||||
from urllib.error import HTTPError, URLError
|
from urllib.error import HTTPError, URLError
|
||||||
from urllib.parse import splithost, splituser
|
from urllib.parse import splithost, splituser
|
||||||
from urllib.request import build_opener, install_opener, ProxyHandler
|
|
||||||
|
|
||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
pass
|
pass
|
||||||
@ -145,14 +143,6 @@ def getUrlFd(url, headers=None, data=None, timeout=None):
|
|||||||
else:
|
else:
|
||||||
request = url
|
request = url
|
||||||
request.add_data(data)
|
request.add_data(data)
|
||||||
httpProxy = force(proxy)
|
|
||||||
if httpProxy:
|
|
||||||
proxyHandler = ProxyHandler({
|
|
||||||
'http': httpProxy,
|
|
||||||
'https': httpProxy
|
|
||||||
})
|
|
||||||
proxyOpener = build_opener(proxyHandler)
|
|
||||||
install_opener(proxyOpener)
|
|
||||||
fd = urlopen(request, timeout=timeout)
|
fd = urlopen(request, timeout=timeout)
|
||||||
return fd
|
return fd
|
||||||
except socket.timeout as e:
|
except socket.timeout as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user