How to disable urllib2 HTTP proxy on Windows?
waldbie at verizon.net
Tue Oct 19 01:52:55 CEST 2004
**** Post for FREE via your newsreader at post.usenet.com ****
When using urllib2.urlopen() on my Windows 2000 machine at work, I was
puzzled that I kept getting back authentication errors from our Internet
proxy server (I was trying to contact an internal machine). Upon digging
into the code a little, I found that urllib2 was pulling the proxy
information out of the Windows registry (Internet Explorer uses these
settings). However, the browser also had settings to disable use of the
proxy for local addresses, and any specific addresses or wildcards I gave
it. urllib2 seemed to be ignoring those.
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.
*** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
More information about the Python-list