Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >

Gray-Ice

个人博客兼个人网站

参考python request 请求https 挂代理报错

这是我在挂了代理后用requests请求Youtube时发生的错误,报错:

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

看到是SSLError后我果断在requests.get()的参数中加入了verify=False,结果还是不行。
然后Google一番后,发现是proxies参数的问题(注: 如果不加proxies参数,只给终端挂代理,运行py文件后会报:requests.exceptions.InvalidURL: Proxy URL had no scheme, should start with http:// or https://):

1
proxies = {"http": "http://localhost:8889", "https": "socks5://localhost:1089"}

让https走socks代理,就解决问题了。
毛病可真多。本篇完。

评论



愿火焰指引你