python requests (Caused by SSLError(SSLEOFError(8, ‘EOF occurred in violation of protocol (_ssl.c:1

python requests请求报错 SSLEOFError

  • HTTPSConnectionPool(host=‘www.showdoc.cc’, port=443): Max retries exceeded with url: /server/index.php?s=/api/item/info (Caused by SSLError(SSLEOFError(8, ‘EOF occurred in violation of protocol (_ssl.c:1124)’)))

解决: windows系统的用户,把你本地起的代理软件关了就ok

  • 30
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 26
    评论
这个错误通常是由于 SSL/TLS 协议版本不兼容导致的。可能是你的代码使用的 SSL/TLS 版本与远程服务器不兼容,或者是远程服务器配置不正确导致 SSL 握手失败。 你可以尝试在代码中指定 SSL/TLS 版本,例如: ```python import ssl import requests ssl_context = ssl.create_default_context() ssl_context.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 # 禁用 TLSv1.0 和 TLSv1.1 response = requests.get('https://mirrors.sustech.edu.cn', verify=False, timeout=5, headers={'User-Agent': 'Mozilla/5.0'}, stream=True, cert=None, allow_redirects=True, proxies=None, auth=None, cookies=None, hooks=None, json=None, params=None, data=None, files=None, proxies=None, timeout=None, verify=None, cert=None) print(response) ``` 如果还是不行,你可以尝试打开 SSL 调试模式,查看 SSL 握手过程中具体的错误信息,例如: ```python import ssl import requests import logging ssl_context = ssl.create_default_context() ssl_context.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 # 禁用 TLSv1.0 和 TLSv1.1 logging.basicConfig(level=logging.DEBUG) response = requests.get('https://mirrors.sustech.edu.cn', verify=False, timeout=5, headers={'User-Agent': 'Mozilla/5.0'}, stream=True, cert=None, allow_redirects=True, proxies=None, auth=None, cookies=None, hooks=None, json=None, params=None, data=None, files=None, proxies=None, timeout=None, verify=None, cert=None) print(response) ``` 希望这些解决方法能够帮到你。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 26
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值