What is a possible cause for [SSL: UNKNOWN_PROTOCO

2020-02-12 09:29发布

The following example GET:

r = requests.get(url, auth=(self.key, ''), verify=False)

Fails with the following traceback:

File "/Library/Python/2.7/site-packages/requests/api.py", line 70, in get
return request('get', url, params=params, **kwargs)
File "/Library/Python/2.7/site-packages/requests/api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)

File "/Library/Python/2.7/site-packages/requests/adapters.py", line 497, in send
raise SSLError(e, request=request)

requests.exceptions.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)

Running python 2.7.12

I can confirm this IS NOT a duplicate of Python requests gives SSL unknown protocol

1条回答
放我归山
2楼-- · 2020-02-12 10:09

The solution to this problem turned out to be related to the requests library.

Adding the following to my python library resolved the issue:

pip install requests[security]

(Note this is not an ideal fix for TLS future security)

查看更多
登录 后发表回答