tcrudge.response module

Functions to handle different response formats must receive two arguments:
  • handler: subclass of tornado.web.RequestHandler;
  • answer: dictionary with response data.

And it should return bytes.

tcrudge.response.response_json(handler, response)

Default JSON response.

Sets JSON content type to given handler.

Serializes result with JSON serializer and sends JSON as response body.

Returns:Bytes of JSONised response
Return type:bytes
tcrudge.response.response_msgpack(handler, response)

Optional MSGPACK response.

Sets MSGPACK content type to given handler.

Packs response with MSGPACK.

Returns:Bytes of MSGPACK packed response
Return type:bytes