Go to the latest version of this document.

# ``twisted`.`web`.`iweb`.`_IRequestEncoder``

interface documentation

`class _IRequestEncoder(Interface): (source)`

Known implementations: `twisted.web.server._GzipEncoder`

View In Hierarchy

An object encoding data passed to `IRequest.write`, for example for compression purpose.

Present Since
12.3

Method | `encode` | Encode the data given and return the result.
Method | `finish` | Callback called when the request is closing.

def encode(data): (source)

Encode the data given and return the result.

Parameters
data:`str` | The content to encode.

Returns
`str` | The encoded data.

def finish(): (source)

Callback called when the request is closing.

Returns
`str` | If necessary, the pending data accumulated from previous `encode` calls.