python-dependency-injector/examples/miniapps/fastapi/giphynavigator/endpoints.py

19 lines
462 B
Python
Raw Normal View History

2020-11-13 01:48:07 +03:00
"""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()],
2020-11-13 01:56:47 +03:00
search_service=Provide[Container.search_service],
2020-11-13 01:48:07 +03:00
):
gifs = await search_service.search(query, limit)
return {
'query': query,
'limit': limit,
'gifs': gifs,
}