API: aj.api.endpoint

exception aj.api.endpoint.EndpointError(inner, message=None)[source]

To be raised by endpoints when a foreseen error occurs. This exception doesn’t cause a client-side crash dialog.

  • inner – inner exception
  • message – message
exception aj.api.endpoint.EndpointReturn(code, data=None)[source]

Raising EndpointReturn will return a custom HTTP code in the API endpoints.

  • code – HTTP code
  • data – response data
aj.api.endpoint.endpoint(page=False, api=False, auth=True)[source]

It’s recommended to decorate all HTTP handling methods with @endpoint.

@endpoint(auth=True) will require authenticated session before giving control to the handler.

@endpoint(api=True) will wrap responses and exceptions into JSON, and will also provide special handling of EndpointsError

  • auth (bool) – requires authentication for this endpoint
  • page (bool) – enables page mode
  • api (bool) – enables API mode


comments powered by Disqus