gpt4 book ai didi

带有代理的 Python 请求导致 SSLError WRONG_VERSION_NUMBER

转载 作者:行者123 更新时间:2023-12-04 22:42:31 24 4
gpt4 key购买 nike

我不能在 Python 中使用不同的代理。
我的代码:

import requests

proxies = {
"https":'https://154.16.202.22:3128',
"http":'http://154.16.202.22:3128'
}

r=requests.get('https://httpbin.org/ip', proxies=proxies)
print(r.json())
我得到的错误是:
.
.
.
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='httpbin.org', port=443): Max retries exceeded with url: /ip (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1122)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

.
.
.
requests.exceptions.SSLError: HTTPSConnectionPool(host='httpbin.org', port=443): Max retries exceeded with url: /ip (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1122)')))
我执行了 pip install requests .
我执行了 pip uninstall pyopenssl ,然后尝试 pip install pyopenssl 的旧版本,但它不起作用。
为什么这不起作用?

最佳答案

问题是由于最新的 urllib3 中的错误(我在版本 1.26.3 中发现的)。尝试降级到 1.23通过 pip3 install urllib3==1.23 ,它应该可以解决问题。

关于带有代理的 Python 请求导致 SSLError WRONG_VERSION_NUMBER,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65526527/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com