通过代理隧道化httplib

编程入门 行业动态 更新时间:2024-10-27 08:35:38
本文介绍了通过代理隧道化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

本文发布于:2023-10-07 12:38:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469402.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:隧道   httplib

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!