python-dependency-injector/examples/miniapps/fastapi/giphynavigator/endpoints.py
2020-11-12 17:48:07 -05:00

19 lines
464 B
Python

"""Endpoints module."""
from dependency_injector.wiring import Provide
from .containers import Container
async def index(
query: str = Provide[Container.config.default.query],
limit: int = Provide[Container.config.default.limit.as_int()],
search_service = Provide[Container.search_service],
):
gifs = await search_service.search(query, limit)
return {
'query': query,
'limit': limit,
'gifs': gifs,
}