This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Improve http.client.HTTPResponse.read documentation
Type: Stage: resolved
Components: Documentation Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, harobed, orsenthil, python-dev, terry.reedy
Priority: normal Keywords: patch

Created on 2011-06-10 19:22 by harobed, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
improve_http.client_documentation.patch harobed, 2011-06-10 19:22 review
Messages (3)
msg138129 - (view) Author: harobed (harobed) Date: 2011-06-10 19:22
This is a patch to improve http.client.HTTPResponse.read documentation.

What do you think about ?
msg138556 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-06-17 22:54
The patch does 3 things:

1. clarify that 'amt' in 'the next amt bytes' means 'amount'.

I do not think this is necessary; 'the next blah bytes' is clear. Actually, 'amt' really means 'number', not 'amount', which would imply that 'amt' is a float, not an int. 'amt' was a poor choice of parameter name and should have been 'n' or 'nbytes' I presume it has to be an int, not a float. Since it is passed on to the socket file wrapper, I suspect that io.rawiobase."read(n=-1) 
Read up to n bytes from the object and return them. As a convenience, if n is unspecified or -1, readall() is called. Otherwise, only one system call is ever made. Fewer than n bytes may be returned if the operating system call returns fewer than n bytes.

If 0 bytes are returned, and n was not 0, this indicates end of file. If the object is in non-blocking mode and no bytes are available, None is returned."
applies, but I am not really sure.

2. Add an example after the entry for .read().
This seems out of place since there is already a section for examples. All three of the existing examples use response.read. One of them could be enlarged slightly to read in chunks if an example is needed.

3. Document .closed
If it were mentioned that HTTPResponse is a subclass of RawIOBase, and perhaps it should be, the existence of .closed might be inferred. But since not everything is implemented, and since .closed is useful to iterate (as should be the example), I agree this should be added.
msg138675 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-06-20 00:00
New changeset d801b570b1dd by Senthil Kumaran in branch '3.2':
Fix closes Issue12315 - Updates to http.client documentation.
http://hg.python.org/cpython/rev/d801b570b1dd
History
Date User Action Args
2022-04-11 14:57:18adminsetgithub: 56524
2011-06-20 00:00:44python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg138675

resolution: fixed
stage: patch review -> resolved
2011-06-17 22:54:05terry.reedysetnosy: + terry.reedy
messages: + msg138556
2011-06-11 16:44:21pitrousetnosy: + orsenthil

stage: patch review
2011-06-10 19:22:55harobedcreate