class documentation

class ContentDecoderAgent: (source)

Constructor: ContentDecoderAgent(agent, decoders)

Implements interfaces: twisted.web.iweb.IAgent

View In Hierarchy

An Agent wrapper to handle encoded content.

It takes care of declaring the support for content in the Accept-Encoding header and automatically decompresses the received data if the Content-Encoding header indicates a supported encoding.

For example:

    agent = ContentDecoderAgent(Agent(reactor),
                                [(b'gzip', GzipDecoder)])
Parameters
agentThe agent to wrap
decodersA sequence of (name, decoder) objects. The name declares which encoding the decoder supports. The decoder must accept an IResponse and return an IResponse when called. The order determines how the decoders are advertised to the server. Names must be unique.not be duplicated.
See Also
GzipDecoder
Present Since
11.1
Method __init__ IAgent does not have any particular requirement upon its constructor.
Method request Send a client request which declares supporting compressed content.
Method _handleResponse Check if the response is encoded, and wrap it to handle decompression.
Instance Variable _agent Undocumented
Instance Variable _decoders Undocumented
Instance Variable _supported Undocumented
def __init__(self, agent, decoders): (source)

IAgent does not have any particular requirement upon its constructor.

def request(self, method, uri, headers=None, bodyProducer=None): (source)

Send a client request which declares supporting compressed content.

See Also
Agent.request.
def _handleResponse(self, response): (source)

Check if the response is encoded, and wrap it to handle decompression.

Undocumented

_decoders = (source)

Undocumented

_supported = (source)

Undocumented