structure¶
"""
├── ourobori
│ ├── apps
│ │ ├── dependencies
│ │ │ ├── dbs,py
│ │ │ ├── hosts.py
│ │ │ ├── __init__.py
│ │ │ └── services.py
│ │ ├── http.py
│ │ ├── __init__.py
│ │ ├── middlewares.py
│ │ └── options.py
│ ├── docs
│ │ ├── __init__.py
│ │ ├── swagger.py
│ │ └── swagger_errors.py
│ ├── __init__.py
│ └── services
│ ├── apis
│ │ ├── http.py
│ │ └── __init__.py
│ ├── errors.py
│ ├── http.py
│ ├── __init__.py
│ ├── logger.py
│ └── rules.py
└── ourobori_apis_schemata
└── schemata.py
"""
details about module ourobori.apps.dependencies.dbs¶
Includes dependencies of databases to be used when calling
ourobori.apps.http.run_service()
.
details about module ourobori.apps.dependencies.hosts¶
Includes dependencies of services to be used when calling
ourobori.apps.http.run_service()
.
details about module ourobori.apps.dependencies.services¶
Includes dependencies of hosts to be used when calling
ourobori.apps.http.run_service()
.
details about module ourobori.apps.http¶
This module contains functions (currently only
ourobori.apps.http.run_service()
is relevant for you) required to create
the service.py
for your own http-service based on ourobori.
details about module ourobori.apps.middlewares¶
This module contains the basic middlewares (currenlty
ourobori.apps.middlewares.error_middleware()
) to be used (passed to
ourobori.apps.http.run_service()
) in the service.py
of your own service
based on ourobori.
details about module ourobori.apps.options¶
This module contains the functions
(ourobori.apps.options.build_arguments()
) to create the
basic-service-arguments and helper-functions to be used for your own
argument-definitions (ourobori.apps.options.add_param()
and
ourobori.apps.options.add_flag()
).
These functions are used in your service.py
to build the options to be passed
to the ourobori.apps.http.run_service()
.
details about module ourobori.docs.swagger¶
This module is used to create the api-documentation-creation in swagger.
The function ourobori.docs.swagger.create_swagger_definition()
is used in your service.py
to create the documentation.
The required definition of your APISPECS in your service.py
can be created
using the classes ourobori.docs.swagger.APISpec
and
ourobori.docs.swagger.OutputDefinition
.
If you defined everything correctly the api-documentation is available (after
you started your service) at
http://<YOUR_HOST>:<YOUR_PORT>/api/doc.
details about module ourobori.docs.swagger_errors¶
This module contains all functions, classes to create the OutputDefinitions of errors used for the creation of the swagger-documentation. It also contains already exsiting OutputDefinitions used by the BaseService.
details about module ourobori.services.apis.decorators¶
This module contains the decorators to be used for the api-methods in your
service.py
.
They are used to transform the request-data and the response-data using
pydantic
.
The ourobori.services.apis.decorators.input_transform()
requires a
pydantic.BaseModel defined in the schemata.py
of the depending package
<your_service>_apis_schemata
as parameter.
Calling the decorated api-method then converts the request-data to an instance
of your passed Model-class.
The ourobori.services.apis.decorators.output_transform()
also requires a
pydantic.BaseModel defined in the schemata.py
of the depending package
<your_service>_apis_schemata
as parameter.
Calling the decorated api-method then converts the returned value of the
api-method to a json-response based on the attributes of the passed
Model-class passed to the decorator.
details about module ourobori.services.errors¶
This module contains all exceptions used in services based on the ourobori.
Additional service specific exceptions have to be defined in the
errors.py
-file of the service and be defined in the service
rules.py
-file in Rules.handle_exceptions
.
details about module ourobori.services.http¶
This module contains the BaseService to inherit from by all http-services
based on ourobori.
The service-class inheriting from the
ourobori.services.http.BaseService
should be placed in the
service.py
-file.
This module also defines the BASE_APISPECS
to be used in your
service.py
file to define the apispecs used by the creation of the
swagger-definition in your service.py
at calling the
ourobori.docs.swagger.create_swagger_definition()
.
Each service based on ourobori should also use the decorators
ourobori.services.apis.http.transform_input()
and
ourobori.services.aois.http.transform_output()
in its api-methods to
transform the input- and output-data of your apis.
details about module ourobori.services.logger¶
ourobori use loguru to log.
The logger to be used by the service is created using
ourobori.service.logger.default_logger()
defined in this module.
The logger is called inside ourobori.apps.http._create_app()
automatically so you only have to define the logfile_path where to log
in your service-rules in rules.py
or by passing the argument --logfile
on service-start.
details about module ourobori.services.rules¶
This module contains the base rules to be implemented as minimum in the Rules
of a service using the ourobori.
So the class Rules
in your rules.py
should inherit from the
:class:BaseRules`.
This module also contains the class
ourobori.services.rules.CustomBasicAuth
which is used when
restricting the access to the service by as BasicAuth.
This authentication has to be defined in your Rules
-class in the attribute
auths
like the following:
class Rules(BaseRules):
auths: CustomBasicAuth = CustomBasicAuth(
valids=[('example_user', 'example_password')])
If you start your service with the flag --auth
the BasicAuth-method
defined there will be used.
details about module ourobori.services.schemata¶
This module was moved to another package: ourobori_apis-schemata
.
This allows the usage of the SI- and SOSchemata in clients.