summaryrefslogtreecommitdiff
path: root/__main__.py
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-08-30 20:25:37 +0200
committerBotond Hende <nettingman@gmail.com>2024-08-30 20:25:37 +0200
commita1de271e186a518932307bb7775f670d8ccd92f5 (patch)
tree20514cca8267d0d8bf0845b58e06b11b15d823fc /__main__.py
parentd41aa536f647726f3d58eb24ae16d5c75d278e0c (diff)
changed import path to relative modul import paths
Diffstat (limited to '__main__.py')
-rw-r--r--__main__.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/__main__.py b/__main__.py
index 833bf72..9dba645 100644
--- a/__main__.py
+++ b/__main__.py
@@ -3,21 +3,21 @@ from typing import Annotated
from fastapi import FastAPI, Depends
-import apirouters.agents
-import modules.database
+from .apirouters import agents
+from .modules import database
@asynccontextmanager
async def lifespan(app: FastAPI):
- modules.database.cursor.execute(
+ database.cursor.execute(
"CREATE TABLE IF NOT EXISTS agents(primary_key INTEGER PRIMARY KEY, callsign TEXT NOT NULL UNIQUE, token_hash TEXT NOT NULL)")
yield
app = FastAPI(lifespan=lifespan)
-app.include_router(apirouters.agents.router)
+app.include_router(agents.router)
@app.get("/{callsign}/tasks")
-async def get_tasks(callsign: str, token: Annotated[str, Depends(apirouters.agents.oauth2_scheme)]):
+async def get_tasks(callsign: str, token: Annotated[str, Depends(agents.oauth2_scheme)]):
return f'{{"callsign": "{callsign}", "token": "{token}"}}'