From d41aa536f647726f3d58eb24ae16d5c75d278e0c Mon Sep 17 00:00:00 2001 From: Botond Hende Date: Sun, 25 Aug 2024 21:20:49 +0200 Subject: renamed variables --- apirouters/agents.py | 4 ++-- modules/database.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apirouters/agents.py b/apirouters/agents.py index 3d148d2..b8c0b95 100644 --- a/apirouters/agents.py +++ b/apirouters/agents.py @@ -5,7 +5,7 @@ from fastapi import APIRouter, Depends, Response from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm from passlib.context import CryptContext -from modules.database import cursor, sq_con +from modules.database import cursor, conn router = APIRouter() pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") @@ -49,5 +49,5 @@ async def init_agent(callsign: str, token: Annotated[str, Depends(oauth2_scheme) token_hash = pwd_context.hash(token) cursor.execute("INSERT INTO agents (callsign, token_hash) VALUES (?, ?)", (callsign, token_hash)) - sq_con.commit() + conn.commit() return '{"result": "Agent successfully registered."}' diff --git a/modules/database.py b/modules/database.py index f75f68e..9a7131c 100644 --- a/modules/database.py +++ b/modules/database.py @@ -7,6 +7,6 @@ db_dir = os.path.dirname(Config.DATABASE_PATH) Path(db_dir).mkdir(parents=True, exist_ok=True) assert sqlite3.threadsafety == 3, "QLite thread safety is not set to 'Serialized'." -sq_con = sqlite3.connect(Config.DATABASE_PATH) -cursor = sq_con.cursor() +conn = sqlite3.connect(Config.DATABASE_PATH) +cursor = conn.cursor() -- cgit v1.2.3-70-g09d2