canarieapi.api

This module defines the generic REST API for platforms and services as defined by the CANARIE API specification.

Module Contents

Functions

handle_exceptions(→ flask.typing.ResponseReturnValue)

Generate error response for raised exceptions.

home(→ flask.typing.ResponseReturnValue)

manual_test(→ flask.typing.ResponseReturnValue)

extern_html_error_handler(...)

Handle HTML errors from an external response.

information(→ flask.typing.ResponseReturnValue)

Info route required by CANARIE.

get_status(→ Dict[str, StatusInfo])

stats(→ flask.typing.ResponseReturnValue)

Stats route required by CANARIE.

status(→ flask.typing.ResponseReturnValue)

Extra route to know service status.

simple_requests_handler(→ flask.typing.ResponseReturnValue)

#Handle simple requests required by CANARIE.

close_connection(→ None)

Disconnect database.

Attributes

StatusInfo

START_UTC_TIME

CANARIE_API_TYPE

CANARIE_API_VALID_REQUESTS

_required

HANDLED_HTML_ERRORS

HANDLED_HTML_ERRORS_STR

canarieapi.api.StatusInfo[source]
canarieapi.api.START_UTC_TIME[source]
canarieapi.api.CANARIE_API_TYPE = ['service', 'platform'][source]
canarieapi.api.CANARIE_API_VALID_REQUESTS[source]
canarieapi.api._required[source]
canarieapi.api.HANDLED_HTML_ERRORS = [400, 404, 405, 500, 503][source]
canarieapi.api.HANDLED_HTML_ERRORS_STR[source]
canarieapi.api.handle_exceptions(exception_instance: Exception) flask.typing.ResponseReturnValue[source]

Generate error response for raised exceptions.

Parameters

exception_instance – Exception instance.

canarieapi.api.home() flask.typing.ResponseReturnValue[source]
canarieapi.api.manual_test() flask.typing.ResponseReturnValue[source]
canarieapi.api.extern_html_error_handler(status_code_str: str) flask.typing.ResponseReturnValue[source]

Handle HTML errors from an external response.

Handle errors that occur externally provided that Apache is configured so that it uses this route for handling errors.

For this add this line for each handled HTML errors in the Apache configuration:

ErrorDocument 400 <Rest root>/400
canarieapi.api.information(route_name: str, api_type: canarieapi.utility_rest.APIType) flask.typing.ResponseReturnValue[source]

Info route required by CANARIE.

canarieapi.api.get_status(route_name: str) Dict[str, StatusInfo][source]
canarieapi.api.stats(route_name: str, api_type: canarieapi.utility_rest.APIType) flask.typing.ResponseReturnValue[source]

Stats route required by CANARIE.

canarieapi.api.status(route_name: str, api_type: canarieapi.utility_rest.APIType) flask.typing.ResponseReturnValue[source]

Extra route to know service status.

canarieapi.api.simple_requests_handler(route_name: str, api_type: canarieapi.utility_rest.APIType, api_request: str = 'home') flask.typing.ResponseReturnValue[source]

#Handle simple requests required by CANARIE.

canarieapi.api.close_connection(_: Exception) None[source]

Disconnect database.

Parameters

_ – Exception handled elsewhere, nothing to do with it