[英]TLSV1_ALERT_PROTOCOL_VERSION with python requests package
I am using the request package as我使用请求包作为
url = 'https://jobregister.aas.org'
page = requests.get(url)
but this leads to the following error但这会导致以下错误
requests.exceptions.ConnectionError:
HTTPSConnectionPool(host=url, port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)'),))
does anybody know what is causing this?有人知道是什么原因造成的吗?
EDIT: I noticed that this error only happens with for the url above.编辑:我注意到这个错误只发生在上面的 url 上。 Other urls don't show this issue?其他网址没有显示这个问题?
I believe that your issue is that '/' does not want to establish communication with your Requests via TLS v1.0 .我相信您的问题是 '/' 不想通过TLS v1.0与您的请求建立通信。
I did encounter identical exception a couple days ago when I was using Python2.7.10 and OpenSSL 1.0.2l on my local machine.几天前,当我在本地机器上使用Python2.7.10和OpenSSL 1.0.2l时,我确实遇到了相同的异常。 This issue was resolved by upgrading to Python2.7.13 .此问题已通过升级到Python2.7.13解决。 I haven't investigated in depth what is causation of Requests raising this exception yet.我还没有深入调查Requests引发此异常的原因。
In my case the server was configured with tls1.1 only.在我的情况下,服务器仅配置了 tls1.1。 The solution was using SSLAdapter.解决方案是使用 SSLAdapter。
import requests, ssl
from requests_toolbelt import SSLAdapter
with requests.Session() as _sess:
_sess.mount("https://", SSLAdapter(ssl.PROTOCOL_TLSv1_1))
res = _sess.post(url_endpoint, **kwargs)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.