简体   繁体   English

TLSV1_ALERT_PROTOCOL_VERSION 与 python 请求包

[英]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.10OpenSSL 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.

相关问题 使用pip安装python软件包时出错(TLSV1_ALERT_PROTOCOL_VERSION) - Error installing python package with pip (TLSV1_ALERT_PROTOCOL_VERSION) 无法安装 Python 包 [SSL: TLSV1_ALERT_PROTOCOL_VERSION] - Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION] requests.exceptions.SSLError:[SSL:TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version(_ssl.c:590) - requests.exceptions.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) 无法安装任何库[SSL:TLSV1_ALERT_PROTOCOL_VERSION] - Not able to install any library [SSL: TLSV1_ALERT_PROTOCOL_VERSION] 升级pip /安装Django-[SSL:TLSV1_ALERT_PROTOCOL_VERSION] - Upgrading pip/installing django - [SSL: TLSV1_ALERT_PROTOCOL_VERSION] 仍然无法安装自动登录-TLSV1_ALERT_PROTOCOL_VERSION - still cannot install autologin - TLSV1_ALERT_PROTOCOL_VERSION Python - Docker 客户端连接中的 tlsv1 警报协议版本错误 - Python - tlsv1 alert protocol version error in Docker client connection 在python中使用请求时,出现以下错误“ TLSV1_ALERT_PROTOCOL_VERSION”。为什么会发生这种情况? - When using requests in python I'm given the following error “TLSV1_ALERT_PROTOCOL_VERSION.” Why might this be happening? 无法在 Ubuntu Linux 中使用 pip 安装 Python 包:InsecurePlatformWarning、SSLError、tlsv1 警报协议版本 - Unable to install Python packages using pip in Ubuntu Linux: InsecurePlatformWarning, SSLError, tlsv1 alert protocol version ssl.SSLError:tlsv1 警报协议版本 - ssl.SSLError: tlsv1 alert protocol version
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM