[twill] Bug? in HTTP Basic Authentication Handling
John J Lee
jjl at pobox.com
Fri Mar 2 06:11:36 PST 2007
On Fri, 2 Mar 2007, subscriptions at smart-knowhow.de wrote:
> What I found seems to be curious: the password handler are coded in
> _auth.py within mechanize. If I put debug code in the "add_password"
> function of HTTPPasswordMgr then the corresponding code is executed if
> is issue a "add_auth" command.
They are forked because the urllib2 code was buggy in 2.4. I submitted
the fixes to SF, and they're there in Python 2.5. Also, ISTR I added a
new proxy password manager to make the front-end proxy auth interface
friendlier (probably I should have written a new one from scratch rather
than derivint it from the urllib2 code...).
> The corresponding find_user_password function is never called (at least
> in my case). I'm currently trying to figure out why...
That suggests you're not getting the expected 401 response from the
Turn on logging of HTTP request and response headers -- either in twill,
or using a simple mechanize script like the one I posted. To turn on the
logging you need in mechanize:
hh = mechanize.HTTPHandler()
hsh = mechanize.HTTPHandler()
opener = mechanize.build_opener(hh, hsh)
response = opener.open(url)
More information about the twill