httplib :: HTTPResponse :: Class HTTPResponse
[hide private]

Class HTTPResponse

Instance Methods [hide private]
 
__init__(self, sock, debuglevel=0, strict=0, method=None, buffering=False)
 
_read_status(self)
 
begin(self)
 
_check_close(self)
 
close(self)
 
isclosed(self)
 
read(self, amt=None)
 
_read_chunked(self, amt)
 
_safe_read(self, amt)
Read the number of bytes requested, compensating for partial reads.
 
fileno(self)
 
getheader(self, name, default=None)
 
getheaders(self)
Return list of (header, value) tuples.
Method Details [hide private]

_safe_read(self, amt)

 

Read the number of bytes requested, compensating for partial reads.

Normally, we have a blocking socket, but a read() can be interrupted by a signal (resulting in a partial read).

Note that we cannot distinguish between EOF and an interrupt when zero bytes have been read. IncompleteRead() will be raised in this situation.

This function should be used when <amt> bytes "should" be present for reading. If the bytes are truly not available (due to EOF), then the IncompleteRead exception can be used to detect the problem.