fixing proxy configuration with and without auth
This commit is contained in:
@@ -348,16 +348,13 @@ class Session(Closeable, SubListener, DealerClient.MessageListener):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _create_client(conf: Session.Configuration) -> requests.Session:
|
def _create_client(conf: Session.Configuration) -> requests.Session:
|
||||||
client = requests.Session()
|
client = requests.Session()
|
||||||
if conf.proxyAuth and conf.proxyType is not Proxy.Type.DIRECT:
|
if conf.proxyAddress and conf.proxyPort and conf.proxyType is not Proxy.Type.DIRECT:
|
||||||
if conf.proxyAuth:
|
|
||||||
proxy_setting = [
|
proxy_setting = [
|
||||||
conf.proxyUsername,
|
conf.proxyUsername,
|
||||||
conf.proxyPassword,
|
conf.proxyPassword,
|
||||||
conf.proxyAddress,
|
conf.proxyAddress,
|
||||||
conf.proxyPort,
|
conf.proxyPort,
|
||||||
]
|
]
|
||||||
else:
|
|
||||||
proxy_setting = [conf.proxyAddress, conf.proxyPort]
|
|
||||||
client.proxies = {
|
client.proxies = {
|
||||||
"http": "{}:{}@{}:{}".format(*proxy_setting),
|
"http": "{}:{}@{}:{}".format(*proxy_setting),
|
||||||
"https": "{}:{}@{}:{}".format(*proxy_setting),
|
"https": "{}:{}@{}:{}".format(*proxy_setting),
|
||||||
|
|||||||
Reference in New Issue
Block a user