linotp.controllers.reporting module¶
reporting controller - interfaces for Reporting
- class linotp.controllers.reporting.ReportingController(name, install_name='', **kwargs)¶
Bases:
BaseControllerreporting
- after_request_funcs: t.Dict[ft.AppOrBlueprintKey, t.List[ft.AfterRequestCallable]]¶
A data structure of functions to call at the end of each request, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
after_request()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- before_request_funcs: t.Dict[ft.AppOrBlueprintKey, t.List[ft.BeforeRequestCallable]]¶
A data structure of functions to call at the beginning of each request, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
before_request()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- deferred_functions: t.List[DeferredSetupFunction]¶
- delete_all()¶
POST /reporting/delete_all
- method:
reporting/delete_all
- description:
delete entries from the reporting database table
- Parameters:
realms – takes realms, only the reporting entries from this realm are deleted. If “realms” is omitted, all realms are evaluated, including /:no realm:/.
status – (optional) filters reporting entries by status like ‘assigned’ or ‘inactive’
returns: dict in which value is the number of deleted rows
- Raises:
Exception – if an error occurs an exception is serialized and returned
- delete_before()¶
POST /reporting/delete_before
delete all entries from reporting database with respect to the arguments
Note
date must be given in format: ‘yyyy-mm-dd’
- Parameters:
date – (optional) only delete entries which are older than date; date must be given in format ‘yyyy-mm-dd’ . if no date is given, all entries get deleted
realms – (optional) takes realms, only the reporting entries from this realm are deleted. If “realms” is omitted, all realms are evaluated, including /:no realm:/.
status – (optional) filters reporting entries by status like ‘assigned’ or ‘inactive’
- Returns:
dict in which value is the number of deleted rows
- Raises:
Exception – if an error occurs an exception is serialized and returned
- error_handler_spec: t.Dict[ft.AppOrBlueprintKey, t.Dict[t.Optional[int], t.Dict[t.Type[Exception], ft.ErrorHandlerCallable]]]¶
A data structure of registered error handlers, in the format
{scope: {code: {class: handler}}}. Thescopekey is the name of a blueprint the handlers are active for, orNonefor all requests. Thecodekey is the HTTP status code forHTTPException, orNonefor other exceptions. The innermost dictionary maps exception classes to handler functions.To register an error handler, use the
errorhandler()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- maximum()¶
GET, POST /reporting/maximum
Deprecated since version 3.2: Requests using HTTP POST method (because it is only reading data). This endpoint will only be available via HTTP GET method in the future.
return the maximum of tokens in a given realm with given status
- Parameters:
realms – (required) takes realms, only the reporting entries for this realms will be displayed. If “realms” is omitted, all realms are evaluated, including /:no realm:/.
status – (optional) (default is ‘active’) takes assigned/unassigned/active/ etc. and shows max of lines in database with this characteristic
- Returns:
a json result with: { “head”: [], “data”: [ [row1], [row2] .. ] }
- Raises:
Exception – if an error occurs an exception is serialized and returned
- name: str¶
- period()¶
GET, POST /reporting/period
Deprecated since version 3.2: Requests using HTTP POST method (because it is only reading data). This endpoint will only be available via HTTP GET method in the future.
return the maximum of tokens in a given realm with given status for a given period
- Parameters:
realms – (required) takes realms, only the reporting entries for this realms will be displayed. If “realms” is omitted, all realms are evaluated, including /:no realm:/.
status – (optional) (default is ‘active’) takes assigned/unassigned/active/ etc. and shows max of lines in database with this characteristic
from – (optional) (default is 1970-1-1) the start day for the reporting max lookup
to – (optional) (default is tomorrow 0:0:0) the end day for the reporting max lookup
- Returns:
a json result with: { “status”: “true”, “value”: {
realms: [ {}, {}], period: {
’from’: ‘to’:
}
} with a realm entry {} as: { ‘realm’: ‘realmname’, ‘tokencount’: {
’active’: nn,
}
}
- Raises:
Exception – if an error occurs an exception is serialized and returned
- show()¶
GET, POST /reporting/show
Deprecated since version 3.2: Requests using HTTP POST method (because it is only reading data). This endpoint will only be available via HTTP GET method in the future.
show entries from the reporting database table
- Parameters:
date – (optional) only show entries which are newer than date; date must be given in format ‘yyyy-mm-dd’ if no date is given, all entries are shown
realms – (optional) takes realms, only the reporting entries from this realm are shown. If “realms” is omitted, all realms are evaluated, including /:no realm:/.
status – (optional) filters reporting entries by status like ‘assigned’ or ‘inactive’
sortby – (optional) sort the output by column
sortdir – (optional) asc/desc
page – (optional) request a certain page
pagesize – (optional) limit the number of returned tokens
outform – (optional) if set to “csv”, the output will be a .csv file
- Returns:
a json result with: { “head”: [], “data”: [ [row1] , [row2] , [row3] .. ] }
in case of csv: first line: header of columns other lines: column values
- Raises:
Exception – if an error occurs an exception is serialized and returned
- teardown_request_funcs: t.Dict[ft.AppOrBlueprintKey, t.List[ft.TeardownCallable]]¶
A data structure of functions to call at the end of each request even if an exception is raised, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
teardown_request()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- template_context_processors: t.Dict[ft.AppOrBlueprintKey, t.List[ft.TemplateContextProcessorCallable]]¶
A data structure of functions to call to pass extra context values when rendering templates, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
context_processor()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- url_default_functions: t.Dict[ft.AppOrBlueprintKey, t.List[ft.URLDefaultCallable]]¶
A data structure of functions to call to modify the keyword arguments when generating URLs, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
url_defaults()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- url_value_preprocessors: t.Dict[ft.AppOrBlueprintKey, t.List[ft.URLValuePreprocessorCallable]]¶
A data structure of functions to call to modify the keyword arguments passed to the view function, in the format
{scope: [functions]}. Thescopekey is the name of a blueprint the functions are active for, orNonefor all requests.To register a function, use the
url_value_preprocessor()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.
- view_functions: t.Dict[str, t.Callable]¶
A dictionary mapping endpoint names to view functions.
To register a view function, use the
route()decorator.This data structure is internal. It should not be modified directly and its format may change at any time.