Package wtf :: Package impl :: Package http :: Module _util :: Class ChunkedWriter
[hide private]
[frames] | no frames]

Class ChunkedWriter

source code

object --+
         |
        ChunkedWriter

Chunked transfer encoding encoder
Instance Methods [hide private]
 
__init__(self, stream)
Initialization
source code
any
__getattr__(self, name)
Delegate undefined attribute requests to the underlying stream
source code
 
write(self, data, _force_empty=False)
Write a chunk of data
source code
 
close(self)
Finish chunked writing
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
file _stream
The stream to write the chunks to
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, stream)
(Constructor)

source code 
Initialization
Parameters:
  • stream (file) - The stream to write the chunks to
Overrides: object.__init__

__getattr__(self, name)
(Qualification operator)

source code 
Delegate undefined attribute requests to the underlying stream
Parameters:
  • name (str) - Attribute name
Returns: any
The requested attribute
Raises:
  • AttributeError - Attribute not found

write(self, data, _force_empty=False)

source code 
Write a chunk of data
Parameters:
  • data (str) - The chunk of data to write
  • _force_empty (bool) - Write the chunk even if data is empty (this will be - by definition - the last chunk)

close(self)

source code 

Finish chunked writing

This writes the last (empty) chunk and closes the stream afterwards.