How to disable urllib2 HTTP proxy on Windows?

Andrew MacIntyre andymac at
Wed Oct 20 01:04:25 CEST 2004

On Mon, 18 Oct 2004, Carl Waldbieser wrote:

> In the Python library reference, I read that setting the HTTP_PROXY
> environment variable could set a proxy, as could installing a new opener.
> However, I tried to turn off proxy support by setting HTTP_PROXY="", and I
> got an error for my trouble (don't recall exact error right now-- am at
> home on my GNU/Linux system).  Is it possible to turn off proxy support in
> Python while leaving the browser settings untouched?  I was really quite
> surprised when I found out that Python was using the browser's proxy
> settings on my behalf.

As I recall, you can do this by passing an empty container (can't remember
whether its a list or dict) to the URL opener factory.

Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at  (pref) | Snail: PO Box 370
        andymac at             (alt) |        Belconnen ACT 2616
Web:               |        Australia

More information about the Python-list mailing list