Untested Ormar and FastAPI update

This commit is contained in:
Mawoka
2025-05-20 12:12:06 +02:00
parent 2bfd73412d
commit 03e85f8586
31 changed files with 719 additions and 694 deletions
+2 -2
View File
@@ -127,9 +127,9 @@ class NotFoundError(Exception):
async def get_images(api_key: str, params: GetImagesParams) -> GetImagesResponse:
async with (
ClientSession() as session,
session.get("https://pixabay.com/api/", params={"key": api_key, **params.dict()}) as resp,
session.get("https://pixabay.com/api/", params={"key": api_key, **params.model_dump()}) as resp,
):
if resp.status == 200:
return GetImagesResponse.parse_obj(await resp.json())
return GetImagesResponse.model_validate(await resp.json())
else:
raise NotFoundError