[ python-Bugs-1258485 ] http auth documentation/implementation conflict

SourceForge.net noreply at sourceforge.net
Sat Aug 13 18:49:31 CEST 2005


Bugs item #1258485, was opened at 2005-08-13 18:49
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1258485&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthias Klose (doko)
Assigned to: Nobody/Anonymous (nobody)
Summary: http auth documentation/implementation conflict

Initial Comment:
 [forwarded from http://bugs.debian.org/304925]

Bug reporter writes:

I was trying to implement a basic HTTP client using
HTTP basic
authorization. The current preferred method of doing
this is by using
urllib2 HTTPPasswordMgr. 

A simple test snippet to try this:

pwmgr=urllib2.HTTPPasswordMgrWithDefaultRealm()
pwmgr.add_password(None, url, username, password)
handler=urllib2.HTTPBasicAuthHandler(pwmgr)
opener=urllib2.build_opener(handler)
urllib2.install_opener(opener)
u=urllib2.urlopen(url)

This did not work. Modifying the second line to:

pwmgr.add_password(None, urlparse.urlparse(url)[1],
username, password)

fixed things, which shows a problem in the
documentation: instead of
a URI or sequence of URIs the add_password method takes
a hostname. 

The documented behaviour would be better since it
allows for multiple
passwords per host, although in reality those will use
different realms.
So I suggest not changing the code in order to not
break existing
application but fixing the documentation instead.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1258485&group_id=5470


More information about the Python-bugs-list mailing list