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

SourceForge.net noreply at sourceforge.net
Mon Apr 23 03:38:44 CEST 2007


Bugs item #1703110, was opened at 2007-04-18 12:56
Message generated for change (Comment added) made by bkline
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: Bob Kline (bkline)
Date: 2007-04-22 21:38

Message:
Logged In: YES 
user_id=291529
Originator: YES

File Added: bug1703110.patch

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

Comment By: Georg Brandl (gbrandl)
Date: 2007-04-22 18:25

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

The docs are maintained separately, you'll have to look at
Doc/lib/liburllib2.tex.

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

Comment By: Bob Kline (bkline)
Date: 2007-04-22 17:00

Message:
Logged In: YES 
user_id=291529
Originator: YES

If I'm not right in assuming that the documentation is generated directly
from urllib2.py let me know and I'll try to find the right separate file in
svn.
File Added: urllib2.py.patch

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

Comment By: Neal Norwitz (nnorwitz)
Date: 2007-04-21 19: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