Skip to content

Response Encoding

Iury O. G. Figueiredo edited this page Dec 5, 2020 · 3 revisions

The response object contains the method content that returns the response body. The encoding of the body is determined by the header in the response. Websnake automatically performs the decoding of the response content. In case it fails it returns a byte string containing the response body.

def handle_response(request, response):
    print('Body:', response.content())

When a given response ResponseHandle.DONE is fired and all handles are called then the underlying temporary file in the response object is closed. Such a file contains the data sent by the server.