根据教程在代码中设置代理(我的梯子 http 端口是 8001)
proxies = {'https': 'https://127.0.0.1:8001', 'http': 'http://127.0.0.1:8001'}
然后通过 requests 包进行网络请求
print(requests.get(url=url, headers=headers, proxies=proxies).text) // 报错
结果报错
Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)'))
但是取消设置代理后通过下面的方式又可以正常请求到资源
print(requests.get(url=url, headers=headers).text) // 能获取到 html 资源
这是什么原因呢? 如果我用 scrapy 框架的话,那应该是在中间件中配置代理还是不配置呢