[英]Error installing python package with pip (TLSV1_ALERT_PROTOCOL_VERSION)
[英]TLSV1_ALERT_PROTOCOL_VERSION with python requests package
我使用請求包作為
url = 'https://jobregister.aas.org'
page = requests.get(url)
但這會導致以下錯誤
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)'),))
有人知道是什么原因造成的嗎?
編輯:我注意到這個錯誤只發生在上面的 url 上。 其他網址沒有顯示這個問題?
我相信您的問題是 '/' 不想通過TLS v1.0與您的請求建立通信。
幾天前,當我在本地機器上使用Python2.7.10和OpenSSL 1.0.2l時,我確實遇到了相同的異常。 此問題已通過升級到Python2.7.13解決。 我還沒有深入調查Requests引發此異常的原因。
在我的情況下,服務器僅配置了 tls1.1。 解決方案是使用 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.