Skip to content
16 changes: 16 additions & 0 deletions Lib/http/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,22 @@ def isclosed(self):
return self.fp is None

def read(self, amt=None):
'''Read and return up to amt bytes.

If the argument is omitted, None, or negative, reads and
returns all data until EOF.

If the argument is positive, and the underlying raw stream is
not 'interactive', multiple raw reads may be issued to satisfy
the byte count (unless EOF is reached first). But for
interactive raw streams (as well as sockets and pipes), at most
one raw read will be issued, and a short result does not imply
that EOF is imminent.

Returns an empty bytes object on EOF.

Returns None if the underlying raw stream was open in non-blocking
mode and no data is available at the moment.'''
if self.fp is None:
return b""

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
documentation of http.client.HTTPResponse.read, Parameter amt fixed.