API documentation

Submodules

api.base_api module

api.exceptions module

exception api.exceptions.BadRequest(message='Bad request format')[source]

Bases: Exception

Exception raised for a bad request format.

message

Explanation of the error.

Type:

str

exception api.exceptions.MiddlewareShortCircuit(response)[source]

Bases: Exception

Exception raised to interrupt middleware processing.

response

The response object or value to be returned directly.

Type:

Any

api.http_api module

class api.http_api.HttpApi(name='SAM-API', cors_headers=None, cors_function=None)[source]

Bases: Api

A class to represent an HTTP API, extending the base Api class.

__call__(event, context, \*args, \*\*kwargs)[source]

Handle the incoming event and context, process the request, and return a response.

api.request module

api.response module

api.rest_api module

class api.rest_api.RestApi(name='SAM-API', cors_headers=None, cors_function=None)[source]

Bases: Api

A class to represent a REST API, extending the base Api class.

__call__(event, context, \*args, \*\*kwargs)[source]

Handle the incoming event and context, process the request, and return a response.

api.websocket_api module

class api.websocket_api.WebsocketApi(name='SAM-API-WEBSOCK')[source]

Bases: object

WebsocketApi class to manage websocket requests and responses.

_config_logging()[source]
_process_middlewares(request: WebsocketApiRequest)[source]
_register_middleware(func)[source]
_register_route(route_key, func)[source]

Register a function to a specific route_key.

property debug
middleware()[source]

Decorator to register a middleware function revisar()…

route(route_key: str)[source]

Decorator to register a route with a specific route_key

Module contents