Skip to content

cattle_grid.dependencies.fastapi

FastAPI uses fastapi.Depends instead of fast_depends.Depends, so when building a fastapi.APIRouter, one needs to use dependencies using the former. These are provided in this package.

ActivityExchangePublisher module-attribute

ActivityExchangePublisher = Annotated[
    Callable, Depends(ActivityExchangePublisherClass)
]

Publisher to the activity exchange

ActivityExchangeRequester module-attribute

ActivityExchangeRequester = Annotated[
    Callable, Depends(ActivityExchangeRequesterClass)
]

Requester to the activity exchange

ClientSession module-attribute

ClientSession = Annotated[
    ClientSession, Depends(get_client_session)
]

The aiohttp.ClientSession used by the application

CommittingSession module-attribute

CommittingSession = Annotated[
    AsyncSession, Depends(with_committing_sql_session)
]

Session annotation to be used with FastAPI. A commit is performed, after processing the request

Config module-attribute

Config = Annotated[Dynaconf, Depends(get_config)]

Returns the configuration

MethodInformation module-attribute

MethodInformation = Annotated[
    List[MethodInformationModel],
    Depends(get_method_information),
]

Returns the information about the methods that are a part of the exchange

SqlAsyncEngine module-attribute

SqlAsyncEngine = Annotated[AsyncEngine, Depends(get_engine)]

Returns the SqlAlchemy AsyncEngine

SqlSession module-attribute

SqlSession = Annotated[
    AsyncSession, Depends(with_fast_api_session)
]

Session annotation to be used with FastAPI

Transformer module-attribute

Transformer = Annotated[
    Callable[[Dict], Awaitable[Dict]],
    Depends(get_transformer),
]

The transformer loaded from extensions