Ligare.web.response

Functions

create_BadRequest_response(error_msg)

Create a 400 `Response.

create_attachment_response(data[, ...])

Create a new Response with appropriate headers for sending PNG data.

Classes

OutputType(value)

An enumeration.

class Ligare.web.response.OutputType(value)[source]

An enumeration.

PNG = 'png'
TIFF = 'tiff'
Ligare.web.response.create_BadRequest_response(error_msg)[source]

Create a 400 `Response.

Parameters:

error_msg (str) – An error message to include in the response’s JSON data.

Return Response:

A 400 Bed Request HTTP response. The response body is a JSON object with the following structure: {

“error_msg”: error_msg, “status”: “Bad Request”, “status_code”: 400

}

Return type:

Response

Ligare.web.response.create_attachment_response(data, attachment_filename='download', output_type=OutputType.PNG)[source]

Create a new Response with appropriate headers for sending PNG data. The response body is the PNG data.

Parameters:
  • data (bytes) – The PNG data.

  • attachment_filename (str) – The name of the filename in the Content-Disposition response header, defaults to “download”.

Return Response:

The PNG HTTP response.

Return type:

Response