本文介绍了通过代理隧道化httplib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图弄清楚如何通过代理将数据发送到服务器.我希望通过tor可以做到这一点,但是由于tor使用了SOCKS,因此httplib显然是不可能的(如果我错了,请纠正我)
I am trying to figure out how to send data to a server through a proxy. I was hoping this would be possible through tor but being as tor uses SOCKS it apparently isn't possible with httplib (correct me if I am wrong)
这就是我现在拥有的
import httplib con = httplib.HTTPConnection("google") con.set_tunnel(proxy, port) con.send("Sent Stuff")问题是,设置隧道后,它似乎冻结了.感谢您的帮助.
The problem is, it seems to freeze when the tunnel is set. Thanks for your help.
推荐答案如果要使用http代理,则应如下所示:
If you want to use http proxy, it should be like this:
import httplib conn = httplib.HTTPConnection(proxyHost, proxyPort) conn.request("POST", "www.google", params)如果您想使用SOCKS代理,则可以按照以下问题使用SocksiPy:如何将SOCKS 4/5代理与urllib2一起使用?
If you want to use SOCKS proxy, you can use SocksiPy as in this question: How can I use a SOCKS 4/5 proxy with urllib2?
更多推荐
通过代理隧道化httplib
发布评论