我在Python脚本中使用了很棒的Requests库:

import requests
r = requests.get("some-site.com")
print r.text


我想用袜子代理。但是请求现在仅支持HTTP代理。

我怎样才能做到这一点?

最佳答案

现代方式:

pip install -U requests[socks]


然后

import requests

resp = requests.get('http://go.to',
                    proxies=dict(http='socks5://user:pass@host:port',
                                 https='socks5://user:pass@host:port'))

关于python - 如何通过 socks 代理使python请求工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58565360/

10-10 23:47
查看更多