Skip to content

AIOHTTP

Classes

Functions

aiohttp_request_factory()

Provide the current aiohttp request as a dependency.

Note that this requires the Wireup-aiohttp integration to be set up.

get_app_container(app)

Return the container associated with the given AIOHTTP application.

get_request_container()

When inside a request, returns the scoped container instance handling the current request.

This requires setup(..., middleware_mode=True).

setup(container, app, handlers=None, *, middleware_mode=True)

Integrate Wireup with AIOHTTP.

If you need access to aiohttp.web.Request in your injectables, add this module to the container's injectables.

Parameters:

Name Type Description Default
container AsyncContainer

A Wireup async container.

required
app Application

An AIOHTTP server application.

required
handlers Optional[Iterable[Type[_WireupHandler]]]

A list of Wireup class-based handlers. See: https://maldoinc.github.io/wireup/latest/integrations/aiohttp/class_based_handlers/

None
middleware_mode bool

If True, adds AIOHTTP middleware that exposes the scoped request container via get_request_container. Set to False to skip middleware and use context-seeded injection in route wrappers for better request-path performance.

True