From 1ccffd6f5dfb22342bea65f63cb2cde39d5ac352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bournhonesque?= Date: Thu, 23 Nov 2023 10:07:02 +0100 Subject: [PATCH] fix: use time.sleep instead of asyncio.sleep in non-corountine function --- app/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api.py b/app/api.py index 51f07b2e..488e1b68 100644 --- a/app/api.py +++ b/app/api.py @@ -1,4 +1,4 @@ -import asyncio +import time import uuid from pathlib import Path from typing import Annotated @@ -124,7 +124,7 @@ def authentication( crud.create_user(db, user=user) return {"access_token": token, "token_type": "bearer"} elif r.status_code == 403: - asyncio.sleep(2) # prevents brute-force + time.sleep(2) # prevents brute-force raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Invalid authentication credentials",