problems with a proxy & authentication
Anthony_Barker
anthony_barker at hotmail.com
Tue Feb 12 15:13:30 EST 2002
I am having problems with python and our company's proxy server, which
requires authentication.
here is the code I am using:
import urllib2
proxy = urllib2.ProxyHandler({"http":"http://myname:mypass@proxyserver.company.com:8080/"})
opener = urllib2.build_opener(proxy)
f = urllib2.urlopen('http://www.python.org')
results
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/urllib2.py", line 138, in urlopen
return _opener.open(url, data)
File "/usr/lib/python2.2/urllib2.py", line 322, in open
'_open', req)
File "/usr/lib/python2.2/urllib2.py", line 301, in _call_chain
result = func(*args)
File "/usr/lib/python2.2/urllib2.py", line 785, in http_open
return self.do_open(httplib.HTTP, req)
File "/usr/lib/python2.2/urllib2.py", line 763, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (101, 'Network is unreachable')>
Under windows error is the same except for the last line (and line
numbers)
URLError: <urlopen error (10051, 'Network is unreachable')>
Both perl and wget work. wget only supports Basic Authentication, so I
assume it is the same. Thinking it might be a network type issue I
changed the domain names to IP addresses. (results follow)
Any help would be appreciated................
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/urllib2.py", line 138, in urlopen
return _opener.open(url, data)
File "/usr/lib/python2.2/urllib2.py", line 322, in open
'_open', req)
File "/usr/lib/python2.2/urllib2.py", line 301, in _call_chain
result = func(*args)
File "/usr/lib/python2.2/urllib2.py", line 785, in http_open
return self.do_open(httplib.HTTP, req)
File "/usr/lib/python2.2/urllib2.py", line 763, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (111, 'Connection refused')>
More information about the Python-list
mailing list