class documentation

class _StreamSlice(object):

Constructor: _StreamSlice(stream, begin, chunksize)

View In Hierarchy

Truncated stream.

Takes a stream and presents a stream that is a slice of the original stream. This is used when uploading media in chunks. In later versions of Python a stream can be passed to httplib in place of the string of data to send. The problem is that httplib just blindly reads to the end of the stream. This wrapper presents a virtual stream that only reads to the end of the chunk.

Method __init__ Constructor.
Method read Read n bytes.
Instance Variable _begin Undocumented
Instance Variable _chunksize Undocumented
Instance Variable _stream Undocumented
def __init__(self, stream, begin, chunksize):

Constructor.

Parameters
stream(io.Base, file object), the stream to wrap.
beginint, the seek position the chunk begins at.
chunksizeint, the size of the chunk.
def read(self, n=-1):

Read n bytes.

Parameters
n
int
the number of bytes to read.
Returns
A string of length 'n', or less if EOF is reached.
_begin =

Undocumented

_chunksize =

Undocumented

_stream =

Undocumented