SSL: WRONG_VERSION_NUMBER

Moh*_*ini 7 python-3.x python-requests

我正在发布这样的请求:

requests.post(URL, headers=HEADERS, cookies=COOKIES, data=DATA, proxies=proxy_list[ip_index], timeout=4)
Run Code Online (Sandbox Code Playgroud)

并返回以下错误:

HTTPSConnectionPool(host='www.example.com', port=443): Max retries exceeded with url: /someurl (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')))
Run Code Online (Sandbox Code Playgroud)

ner*_*ike 6

根据您的代理设置,代理服务器可能是造成这种情况的罪魁祸首。如果您已将 https_proxy 设置为 https:// 路径,则代理服务器可能会干扰 TLS 的验证过程。将其更改为http://proxy.address允许代理服务器打开连接,然后在主机和目标之间发生 TLS 握手。

尝试使用类似设置的 curl -v 来查看发生了什么会很有用,因为 python ssl 绑定可能会误解/掩盖底层库中的错误。

究其根源,我推测 Debian 等发行版的长期稳定映像最近的更新导致了大量这些问题出现,而这些问题以前可能是不可见的。