From aa52e0f8733c1762637c6d0b001068343251f6e2 Mon Sep 17 00:00:00 2001 From: Sebastian Serfling Date: Mon, 21 Aug 2023 10:44:09 +0200 Subject: [PATCH] ADD VOLUME_MOUNT --- main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 5bc80dd..b5f6cc4 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,7 @@ import uvicorn import logging import auth from fastapi.security.api_key import APIKey +import datetime logging.basicConfig(level=logging.DEBUG) # add this line logger = logging.getLogger("foo") @@ -54,6 +55,10 @@ app = FastAPI() async def notify(): return database(f"SELECT * FROM Notifications", "Stines-GmbH","") +@app.get("gettime") +async def gettime(api_key: APIKey = Depends(auth.get_api_key)): + return f"Current Time is {datetime.now()}" + @app.post("/ping") async def ping(ping: CL.CL_Ping_Set,api_key: APIKey = Depends(auth.get_api_key)): database(f"INSERT INTO `Ping-Server` VALUES ('{datetime.now()}','{ping.name}','{ping.ipaddress}')","Stines-GmbH","") @@ -69,13 +74,13 @@ async def database_get(get: CL.CL_Database_get,api_key: APIKey = Depends(auth.ge return False @app.post("/info/getdatabase") -async def getdatabase(get: CL.CL_GET_DATABASE): +async def getdatabase(get: CL.CL_GET_DATABASE,api_key: APIKey = Depends(auth.get_api_key)): return database(f"SELECT name FROM `Kunden-Server` where `IP-Adresse` = '{get.ip}'","Stines-GmbH","")[0][0] @app.post("/dbset") -async def dbset(get: CL.CL_Database_set): +async def dbset(get: CL.CL_Database_set,api_key: APIKey = Depends(auth.get_api_key)): database(get.query,get.dbname,"") - return f"Creatd {get.dbname}" + return f"Created {get.dbname}" @app.post("/cpu_info") async def cpu_info(get: CL.CL_CPUinfo,api_key: APIKey = Depends(auth.get_api_key)):