Commit 42268d44 authored by Laurent Bachelier's avatar Laurent Bachelier 🐧

PROTOCOL_TLSv1 is deprecated in favor of PROTOCOL_TLS

The documentation recommends flags "OP_NO_SSLv3" in case we want to
force TLS.
parent 80bdefc8
...@@ -45,7 +45,10 @@ class AmundiBrowser(LoginBrowser): ...@@ -45,7 +45,10 @@ class AmundiBrowser(LoginBrowser):
""" """
preq = super(AmundiBrowser, self).prepare_request(req) preq = super(AmundiBrowser, self).prepare_request(req)
conn = self.session.adapters['https://'].get_connection(preq.url) conn = self.session.adapters['https://'].get_connection(preq.url)
conn.ssl_version = ssl.PROTOCOL_TLS try:
conn.ssl_version = ssl.PROTOCOL_TLS
except AttributeError:
conn.ssl_version = ssl.PROTOCOL_TLSv1
return preq return preq
def do_login(self): def do_login(self):
......
...@@ -131,7 +131,10 @@ class HSBC(LoginBrowser): ...@@ -131,7 +131,10 @@ class HSBC(LoginBrowser):
preq = super(HSBC, self).prepare_request(req) preq = super(HSBC, self).prepare_request(req)
conn = self.session.adapters['https://'].get_connection(preq.url) conn = self.session.adapters['https://'].get_connection(preq.url)
conn.ssl_version = ssl.PROTOCOL_TLSv1 try:
conn.ssl_version = ssl.PROTOCOL_TLS
except AttributeError:
conn.ssl_version = ssl.PROTOCOL_TLSv1
return preq return preq
......
...@@ -148,7 +148,10 @@ class WellsFargo(LoginBrowser): ...@@ -148,7 +148,10 @@ class WellsFargo(LoginBrowser):
""" """
preq = super(WellsFargo, self).prepare_request(req) preq = super(WellsFargo, self).prepare_request(req)
conn = self.session.adapters['https://'].get_connection(preq.url) conn = self.session.adapters['https://'].get_connection(preq.url)
conn.ssl_version = ssl.PROTOCOL_TLSv1 try:
conn.ssl_version = ssl.PROTOCOL_TLS
except AttributeError:
conn.ssl_version = ssl.PROTOCOL_TLSv1
return preq return preq
def get_account(self, id_): def get_account(self, id_):
......
...@@ -784,7 +784,7 @@ socket.getaddrinfo = my_getaddrinfo ...@@ -784,7 +784,7 @@ socket.getaddrinfo = my_getaddrinfo
class HTTPSConnection2(httplib.HTTPSConnection): class HTTPSConnection2(httplib.HTTPSConnection):
_HOSTS = {} _HOSTS = {}
_PROTOCOLS = [getattr(ssl, pn) for pn in ['PROTOCOL_TLSv1_2', 'PROTOCOL_TLSv1_1', 'PROTOCOL_TLSv1', 'PROTOCOL_SSLv23'] if hasattr(ssl, pn)] _PROTOCOLS = [getattr(ssl, pn) for pn in ['PROTOCOL_TLS', 'PROTOCOL_TLSv1_2', 'PROTOCOL_TLSv1_1', 'PROTOCOL_TLSv1', 'PROTOCOL_SSLv23'] if hasattr(ssl, pn)]
def _my_create_connection(self): def _my_create_connection(self):
sock = socket.create_connection((self.host, self.port), self.timeout) sock = socket.create_connection((self.host, self.port), self.timeout)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment