Untested Ormar and FastAPI update
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user