[Twisted-Python] Proxy support through urllib2?

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Mon Jan 11 09:18:31 EST 2010


On 01:33 pm, gabriel.rossetti at arimaz.com wrote:
>Hello everyone,
>
>Is it possible to use a proxy with Twisted? I can do this with urllib2 
>:
>
>proxy = urllib2.ProxyHandler({"http": "http://my.proxy.com:8080"})
>opener = urllib2.build_opener(proxy)
>urllib2.install_opener(opener)
>
>will that suffice? I'd need SOCKSv5 and HTTP proxy support.

This is one of the features the new HTTP client is intended to make 
easier to implement.  The very short twisted.web.client.Agent is 
responsible for all the things which differ when connecting to a proxy 
instead of doing the usual thing.  At some point, twisted.web.client 
should offer something like Agent which provides the proxy 
functionality.  Do you want to take a stab at implementing it?

Jean-Paul



More information about the Twisted-Python mailing list