广告
返回顶部
首页 > 资讯 > 后端开发 > Python >python 关于Caused by SSLError(SSLEOFError(8, ‘EOF occurred in violation of protocol (_ssl.c:1131)‘)
  • 204
分享到

python 关于Caused by SSLError(SSLEOFError(8, ‘EOF occurred in violation of protocol (_ssl.c:1131)‘)

pythonssl开发语言 2023-09-13 12:09:32 204人浏览 安东尼

Python 官方文档:入门教程 => 点击学习

摘要

# -*- coding: utf-8 -*-import requestsheaders = {'user-agent': 'Mozilla/5.0 (windows NT 10.0; Win64; x64) AppleWEBKit/53

# -*- coding: utf-8 -*-import requestsheaders = {'user-agent': 'Mozilla/5.0 (windows NT 10.0; Win64; x64) AppleWEBKit/537.36 (Khtml, like Gecko) Chrome/105.0.0.0 Safari/537.36'}proxy = {"Http": "http://122.230.151.87:35920", "https": "https://122.230.151.87:35920"}url = 'https://www.qcc.com'response = requests.get(url, proxies=proxy, headers=headers)print(response.text)

报错如下:

 requests.exceptions.SSLError: HTTPSConnectionPool(host='www.qcc.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1131)')))

有两种解决方法:

方法1:

降低urllib3的版本 <= 1.25.11

pip install urllib3==1.25.11

方法2:

https:// > http://

daili

{"http": "http://122.230.151.87:35920", "https": "https://122.230.151.87:35920"}

改为:

{"http": "http://122.230.151.87:35920", "https": "http://122.230.151.87:35920"}


两种方法选一种即可

结果正常返回数据

来源地址:https://blog.csdn.net/whn18723613485/article/details/128190119

--结束END--

本文标题: python 关于Caused by SSLError(SSLEOFError(8, ‘EOF occurred in violation of protocol (_ssl.c:1131)‘)

本文链接: https://www.lsjlt.com/news/405913.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作