[ python-Bugs-1703110 ] Incorrect example for add_password()

SourceForge.net noreply at sourceforge.net
Sun Apr 22 01:49:33 CEST 2007


Bugs item #1703110, was opened at 2007-04-18 09:56
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1703110&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: Documentation
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Bob Kline (bkline)
Assigned to: Nobody/Anonymous (nobody)
Summary: Incorrect example for add_password()

Initial Comment:
In the documentation for urllib2, the example [1] for using basic HTTP authentication has the following code for the call to add_password():

auth_handler.add_password('realm', 'host', 'username', 'password')

This actually worked in earlier (pre-2.4.3) versions of urllib2, but even in those older versions, the documentation for HTTPPasswordMgr.add_password() makes it clear that a URI must be passed as the second argument to the method, not a host name.

Even though the behavior in the library method has changed (passing a full URI versions of Python earlier than 2.4.3 didn't work, at least when a non-standard port was specified), the documentation has not changed (the add_password() documentation specifies a URI, even in the pre-2.4.3 versions of Python) and the examples in the documentation for urllib2 still say 'host'.

[1] http://docs.python.org/lib/urllib2-examples.html

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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-04-21 16:49

Message:
Logged In: YES 
user_id=33168
Originator: NO

Bob, can you submit a patch to correct these problems?  Note:  we no
longer support the 2.4 series.

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

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


More information about the Python-bugs-list mailing list