minos.networks.rest.handlers module

class minos.networks.rest.handlers.RestHandler(host, port, endpoints, **kwargs)[source]

Bases: minos.common.setup.MinosSetup

Rest Handler class.

__init__(host, port, endpoints, **kwargs)[source]
property already_destroyed: bool

Already Destroy getter.

Return type

bool

Returns

A boolean value.

property already_setup: bool

Already Setup getter.

Return type

bool

Returns

A boolean value.

async destroy()

Destroy miscellaneous repository things.

Return type

None

Returns

This method does not return anything.

property endpoints: dict[(<class 'str'>, <class 'str'>), typing.Callable]

Endpoints getter.

Return type

dict[(<class ‘str’>, <class ‘str’>), typing.Callable]

Returns

A dictionary value.

classmethod from_config(config=None, **kwargs)

Build a new instance from config.

Parameters
  • config (typing.Union[minos.common.configuration.config.MinosConfig, pathlib.Path, None]) – Config instance. If None is provided, default config is chosen.

  • kwargs – Additional named arguments.

Return type

~S

Returns

A instance of the called class.

get_app()[source]

Return rest application instance.

Return type

aiohttp.web_app.Application

Returns

A web.Application instance.

static get_callback(fn)[source]

Get the handler function to be used by the aiohttp Controller.

Parameters

fn (typing.Callable[[RestRequest], Union[RestResponse, None, Awaitable[Optional[RestResponse]]]]) – The action function.

Return type

typing.Callable[[Request], Awaitable[Response]]

Returns

A wrapper function around the given one that is compatible with the aiohttp Controller.

property host: str

Get the rest host.

Return type

str

Returns

A str object.

property port: int

Get the rest port.

Return type

int

Returns

An integer value.

async setup()

Setup miscellaneous repository things.

Return type

None

Returns

This method does not return anything.