Выполняю запрос:
res = requests.get(
url='https://host/api/v1/users/current',
headers={
'Authorization': token
}
)
В ответ:
requests.exceptions.SSLError: HTTPSConnectionPool(host='host', port=443): Max retries exceeded with url: /api/v1/users/current (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_read_bytes', 'sslv3 alert handshake failure')],)",),))
На api используются протокол и шифр:
ssl_protocols: TLSv1
ssl_ciphers: GOST2012-GOST8912-GOST8912
Подскажите, как исправить?
Нашел такой пример, но он ничем не помог:
Пример
class Myadapter(HTTPAdapter):
def init_poolmanager(self, connections, maxsize, block=False):
"""Create and initialize the urllib3 PoolManager."""
self.poolmanager = PoolManager(
num_pools=connections,
maxsize=maxsize,
block=block,
ssl_version=ssl.PROTOCOL_TLSv1_2
)
def requests_session(session=None):
try:
adapter = Myadapter()
session.mount('http://', adapter)
session.mount('https://', adapter)
return session
except Exception:
('requests_session - Error Api calls')