[Python-bugs-list] [Bug #129651] documentation error in 2.0, section 11.4.2 (httplib example)

noreply@sourceforge.net noreply@sourceforge.net
Mon, 22 Jan 2001 07:54:42 -0800


Bug #129651, was updated on 2001-Jan-22 00:36
Here is a current snapshot of the bug.

Project: Python
Category: Documentation
Status: Closed
Resolution: Fixed
Bug Group: None
Priority: 5
Submitted by: gaul
Assigned to : fdrake
Summary: documentation error in 2.0, section 11.4.2 (httplib example)

Details: In section 11.4.2 (httplib examples), the second example is
incorrect.  Several variables (paramstring, errcode) are used but not
defined.  The proper sample code follows:

>>> import httplib, urllib
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>> h = httplib.HTTP("www.musi-cal.com:80")
>>> h.putrequest("POST", "/cgi-bin/query")
>>> h.putheader("Content-length", "%d" % len(params))
>>> h.putheader('Accept', 'text/plain')
>>> h.putheader('Host', 'www.musi-cal.com')
>>> h.endheaders()
>>> h.send(params)
>>> errcode, msg, hdrs = h.getreply()
>>> print errcode # should be 200
>>> data = h.getfile().read() # get the raw HTML

The lines changed are:
h.send(paramstring)  ->  h.send(params)
reply, msg, hdrs = h.getreply()  ->  errcode, msg, hdrs = h.getreply()

Follow-Ups:

Date: 2001-Jan-22 07:54
By: fdrake

Comment:
Already fixed in CVS using a similar patch.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=129651&group_id=5470