class documentation
class ContentDecoderAgent: (source)
Constructor: ContentDecoderAgent(agent, decoders)
Implements interfaces: twisted.web.iweb.IAgent
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 | |
agent | The agent to wrap |
decoders | A 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__ |
Undocumented |
Method | request |
Send a client request which declares supporting compressed content. |
Method | _handle |
Check if the response is encoded, and wrap it to handle decompression. |
Instance Variable | _agent |
Undocumented |
Instance Variable | _decoders |
Undocumented |
Instance Variable | _supported |
Undocumented |