如何通过袜子代理使python请求工作
问题内容:
我在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'))