[EMAIL PROTECTED] (John J. Lee) writes:

> Alejandro Dubrovsky <[EMAIL PROTECTED]> writes:
[...Alejandro complains about non-working HTTP proxy auth in urllib2...]

[...John notes urllib2 bug...]
> A workaround is to supply a stupid HTTPPasswordMgr that always returns
> the proxy credentials regardless of what the handler asks it for (only
> tested with a perhaps-broken 2.5 install, since I've broken my 2.4
> install):
[...snip ugly code]
> Yuck, yuck, yuck!  I had realised the auth/proxies code in urllib2 was
> buggy, but...  And all those hoops to jump through.
> 
> Also, if you're using 2.5 SVN HEAD, it seems revision 42133 broke
> ProxyHandler in an attempt to fix the URL host:post syntax!
[...]

In fact the following also works with Python 2.3.4:

import urllib2
proxy_handler = urllib2.ProxyHandler({"http": "http://john:[EMAIL 
PROTECTED]:3128"})
print urllib2.build_opener(proxy_handler).open('http://python.org/').read()


...but only just barely skirts around the bugs!-)  :-(

(at least, the current bugs: I've no reason to work out what things
were like back in 2.3.4, but the above certainly works with that
version)


John

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to