[Python-bugs-list] [ python-Bugs-413135 ] urllib2 fails with proxy requiring auth
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 02 Apr 2001 07:14:33 -0700
Bugs item #413135, was updated on 2001-04-02 07:14
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=413135&group_id=5470
Category: Python Library
Group: None
Status: Open
Priority: 5
Submitted By: Paul Moore (pmoore)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2 fails with proxy requiring auth
Initial Comment:
The following program:
import urllib2
proxy_info = {
'user' : 'my_name', 'pass' : 'my_pass',
'host' : "my-proxy", 'port' : 80
}
# build a new opener that uses a proxy requiring
# authorization
proxy_support = urllib2.ProxyHandler(
{"http" :
"http://%(user)s:%(pass)s@%(host)s:%(port)d"
% proxy_info})
opener = urllib2.build_opener(proxy_support,
urllib2.HTTPHandler)
# install it
urllib2.install_opener(opener)
f = urllib2.urlopen('http://www.python.org/')
print f.headers
print f.read()
fails with the following error on Python 2.1b2 (on
Windows)
C:\Data>python21 proxy_auth.py
Traceback (most recent call last):
File "proxy_auth.py", line 18, in ?
f = urllib2.urlopen('http://www.python.org/')
File "c:\applications\python21\lib\urllib2.py", line
135, in urlopen
return _opener.open(url, data)
File "c:\applications\python21\lib\urllib2.py", line
318, in open
'_open', req)
File "c:\applications\python21\lib\urllib2.py", line
297, in _call_chain
result = func(*args)
File "c:\applications\python21\lib\urllib2.py", line
823, in http_open
return self.do_open(httplib.HTTP, req)
File "c:\applications\python21\lib\urllib2.py", line
801, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error host not found>
A similar error occurred in beta 1, but this was
reported as bug 406683. The fix is in beta 2. I
applied the fix manually in beta 1, and it worked, so
I can only assume that something else changed in the
transition from beta 1 to beta 2, which broke this
again.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=413135&group_id=5470