Python Urllib2 Can Open Localhost But Not 127.0.0.1
I am using python urllib2 library and can see a strange and nasty problem. Windows 7. My code: import urllib2 as url_request opener = url_request.build_opener(url_request.ProxyHa
Solution 1:
Set a no_proxy
or NO_PROXY
environment key with 127.0.0.1
, optionally with localhost
too:
import osos.environ['no_proxy'] = '127.0.0.1,localhost'
On Windows the ProxyOverride
key in the HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings
registry is consulted as well, you probably have localhost
registered as exception. Check your proxy settings to verify this.
Post a Comment for "Python Urllib2 Can Open Localhost But Not 127.0.0.1"