API Documentation

This module contains helper functions that help you model your API responses consistently using the JSend specification.

class jsendit.respond.JSendStatus[source]

Bases: enum.Enum

Variables
  • SUCCESS – All went well and (usually) some data is returned (200).

  • FAIL – There was a problem with the data submitted or some pre-condition of the API wasn’t satisfied (400).

  • ERROR – An error occurred in processing the request (500).

ERROR = 'error'
FAIL = 'fail'
SUCCESS = 'success'
http_code = <function JSendStatus.http_code>[source]
jsendit.respond.response(status: jsendit.respond.JSendStatus, message: str = None, data: Mapping[str, Any] = None)[source]

Construct a JSend response message.

Parameters
  • status – the general status or HTTP code

  • message – the response message

  • data – additional response data

Returns

the response message