Making urllib2 work with proxy urls

simo simoninusa2001 at yahoo.co.uk
Tue Apr 13 18:54:31 EDT 2004


pythonguy at Hotpop.com (Anand Pillai) wrote:

> My company uses an automatic proxy configuration url of the form
> http://server.company.com/department/proxy.pac .
> 
> I have made urllib2 work with normal proxies/firewalls, even the ones
> requiring authentication, but I am stuck with this problem.
> 
> I tried getting the actual proxy server IP and configuring urllib2
> with the normal way it works with proxies, but it has not worked
> for me.

The pac file is usually just a script with the config data for
browsers, it will return something like "PROXY
http-proxy.mydomain.com:80"

I very much doubt urllib2 can actually proces the .pac file.

You should be able to open that file and figure out what you need to
set the proxy variable to in urllib2 (or your ENVironment).

urllib just "automagically" works through proxies, not sure about
2....



More information about the Python-list mailing list