[Twisted-web] simple proxy example?

Wendell Turner wendell at adsi-m4.com
Tue Sep 5 11:40:04 CDT 2006

On Mon, Aug 28, 2006 at 02:33:02PM -0700, David Reid wrote:
> On Mon, Aug 28, 2006 at 04:29:31PM -0400, Wendell Turner wrote:
> > 
> > The webdownload.py script in Abe Fettig's book works fine for
> > directly connected machines.  I would like to modify it to use a
> > proxy.  Most of the examples in the twisted docs seem to show
> > how to write a proxy, not how to use one.
> So that everyone is on the same page, are you attempting to download pages via an http proxy?

Yes, just using an http proxy.  Current solution is:

    def gotProtocol(p):
        p.sendMessage("GET " + webpageurl + "\n\r")

    c.connectTCP(proxyhost, proxyport).addCallback(gotProtocol)

But there should be a better way.

> If yes:
>   There is currently a ticket in the tracker about client support for
> proxies http://twistedmatrix.com/trac/ticket/1774

Thanks, I'll take a look at the patch.  Although, according to
the notes, it may take some effort to do it 'properly'.


More information about the Twisted-web mailing list