Bugs item #1258485, was opened at 2005-08-13 18:49
Message generated for change (Comment added) made by birkenfeld
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: Closed
>Resolution: Invalid
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.



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

>Comment By: Georg Brandl (birkenfeld)
Date: 2006-02-19 01:21

Message:
Logged In: YES 
user_id=1188172

The given URI is split via urlparse, so adding a protocol
wouldn't matter. The problem must have been a different one,
perhaps a misspelling.

Closing as Invalid.

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

Comment By: Mike Foord (mjfoord)
Date: 2005-08-30 14:58

Message:
Logged In: YES 
user_id=1123892

I think it likely that the OP was using a URL that *included* 
the protocol - (i.e. "http://www.somedomain.com/path";) 
instead of just "www.somedomain.com/path".

It is a problem that also bit me - and could *definitely* do with 
a mention in the docs.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1258485&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to