app.api.v2 package

Subpackages

Submodules

app.api.v2.errors module

exception app.api.v2.errors.DataValidationError(message=None, name=None, value=None)

Bases: Exception

exception app.api.v2.errors.RequestBodyParseError

Bases: Exception

Base class for HTTP body parsing errors.

exception app.api.v2.errors.RequestUnparsableJsonError(message=None)

Bases: RequestBodyParseError

Raised when a request body is not parsable (i.e., it is not well-formed json)

exception app.api.v2.errors.RequestValidationError(message=None, errors=None)

Bases: RequestBodyParseError

Raised when an http request body contains json that is not schema-valid.

app.api.v2.responses module

exception app.api.v2.responses.JsonHttpBadRequest(error, details=None, **kwargs)

Bases: JsonHttpErrorResponse, HTTPBadRequest

An HTTP 400 response with a json formatted body.

class app.api.v2.responses.JsonHttpErrorResponse(error, details=None, **kwargs)

Bases: object

Base class for json formatted versions of aiohttp responses.

exception app.api.v2.responses.JsonHttpForbidden(error, details=None, **kwargs)

Bases: JsonHttpErrorResponse, HTTPForbidden

An HTTP 403 response with a json formatted body.

exception app.api.v2.responses.JsonHttpNotFound(error, details=None, **kwargs)

Bases: JsonHttpErrorResponse, HTTPNotFound

An HTTP 404 response with a json formatted body.

async app.api.v2.responses.apispec_request_validation_middleware(request, handler)

Middleware to handle errors thrown by schema validation

Must be added before validation_middleware

async app.api.v2.responses.json_request_validation_middleware(request, handler)

Middleware that converts json decoding and marshmallow validation errors into 400 responses w/ json bodies.

app.api.v2.security module

app.api.v2.security.authentication_exempt(handler)

Mark the endpoint handler as not requiring authentication.

Note:

This only applies when the authentication_required_middleware is being used.

app.api.v2.security.authentication_required_middleware_factory(auth_svc)

Enforce authentication on every endpoint within an web application.

Note:

Any endpoint handler can opt-out of authentication using the @authentication_exempt decorator.

app.api.v2.security.is_handler_authentication_exempt(handler)

Return True if the endpoint handler is authentication exempt.

async app.api.v2.security.pass_option_middleware(request, handler)

Allow all ‘OPTIONS’ request to the server to return 200 This mitigates CORS issues while developing the UI.

app.api.v2.validation module

app.api.v2.validation.check_not_empty_string(value, name=None)
app.api.v2.validation.check_positive_integer(value, name=None)

Module contents

app.api.v2.make_app(services)