minos.networks.http.connectors

Classes

HttpConnector

class HttpConnector[source]

Bases: HttpConnector, InjectableMixin, Generic[RawRequest, RawResponse]

__init__(adapter, host=None, port=None, max_connections=5, **kwargs)[source]
Parameters
async start()[source]

Start the connector.

Returns

This method does not return anything.

Return type

None

async stop()[source]

Stop the connector.

Returns

This method does not return anything.

Return type

None

mount_routes()[source]

Mount the routes given by the adapter.

Returns

This method does not return anything.

Return type

None

mount_route(path, method, callback)[source]

Mount a new route on the application.

Parameters
Returns

This method does not return anything.

adapt_callback(callback)[source]

Get the adapted callback to be used by the connector.

Parameters

callback (Callable[[Request], Union[Response, None, Awaitable[Optional[Response]]]]) – The function.

Returns

A wrapper function on top of the given one that is compatible with the connector.

Return type

Callable[[RawRequest], Awaitable[RawResponse]]

property host: str

Get the host.

Returns

A str value.

property port: int

Get the port.

Returns

A int value.

property routes: dict[minos.networks.decorators.definitions.http.abc.HttpEnrouteDecorator, collections.abc.Callable[[minos.networks.requests.abc.Request], Union[minos.networks.requests.abc.Response, NoneType, Awaitable[Optional[minos.networks.requests.abc.Response]]]]]

Get the port.

Returns

A int value.

property adapter: minos.networks.http.adapters.HttpAdapter

Get the port.

Returns

A int value.

property already_destroyed: bool

Already Destroy getter.

Returns

A boolean value.

property already_setup: bool

Already Setup getter.

Returns

A boolean value.

async destroy()

Destroy miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

classmethod from_config(config=None, **kwargs)

Build a new instance from config.

Parameters
  • config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.

  • kwargs – Additional named arguments.

Returns

A instance of the called class.

Return type

S

classmethod get_injectable_name()

Get the injectable name.

Returns

A str value.

Return type

str

async setup()

Setup miscellaneous repository things.

Returns

This method does not return anything.

Return type

None