precommit

This commit is contained in:
2024-02-04 07:58:44 +03:00
parent 537b89dbaf
commit b98da839ed
10 changed files with 64 additions and 31 deletions

View File

@@ -10,6 +10,7 @@ import logging
logger = logging.getLogger("\t[services.auth]\t")
logger.setLevel(logging.DEBUG)
async def check_auth(req) -> str | None:
token = req.headers.get("Authorization")
user_id = ""
@@ -49,6 +50,7 @@ async def check_auth(req) -> str | None:
return user_id
except Exception as e:
import traceback
traceback.print_exc()
# Handling and logging exceptions during authentication check
print(f"[services.auth] Error {e}")

View File

@@ -9,6 +9,7 @@ headers = {"Content-Type": "application/json"}
# TODO: rewrite to orm usage?
async def _request_endpoint(query_name, body) -> Any:
async with aiohttp.ClientSession() as session:
async with session.post(API_BASE, headers=headers, json=body) as response:

View File

@@ -9,6 +9,7 @@ import logging
logger = logging.getLogger("\t[services.redis]\t")
logger.setLevel(logging.DEBUG)
class RedisCache:
def __init__(self, uri=REDIS_URL):
self._uri: str = uri