[Twisted-Python] Proxy support through urllib2?

Gabriel Rossetti gabriel.rossetti at arimaz.com
Tue Jan 19 04:15:19 EST 2010


exarkun at twistedmatrix.com wrote:
> 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
>   
Ok, thanks for the info. I can have a try, right now we use Twisted 
8.1.0 though, I have to get something working with that version first 
and then whe we've tested our app with version 9.0 I'll try.

Gabriel





More information about the Twisted-Python mailing list