Untested Ormar and FastAPI update
This commit is contained in:
@@ -166,7 +166,7 @@ async def handle_import_from_excel(data: BinaryIO, user: User) -> Quiz:
|
||||
answers=answers_list,
|
||||
time=str(time),
|
||||
image=existing_question["image"] if existing_question is not None else None,
|
||||
).dict()
|
||||
).model_dump()
|
||||
)
|
||||
if existing_quiz is None:
|
||||
quiz = Quiz(
|
||||
|
||||
@@ -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