From 6e76c425921fa4ab6824f2a78181eaa5944b5e5f Mon Sep 17 00:00:00 2001 From: Sebastian Serfling Date: Fri, 13 Oct 2023 09:59:03 +0200 Subject: [PATCH] Remove API key From Console --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index c9759fb..7f51b5c 100644 --- a/main.py +++ b/main.py @@ -96,7 +96,11 @@ async def gethost(get: CL.CL_GET_HOST,api_key: APIKey = Depends(auth.get_api_key @app.post("/host/get/database") async def getdatabase(get: CL.CL_GET_DATABASE,api_key: APIKey = Depends(auth.get_api_key)): - return database(f"SELECT Datenbank FROM `Kunden` where `Subnetz` = '{get.ip}'","Stines-GmbH","")[0][0] + result = database(f"SELECT Datenbank FROM `Kunden` where `Subnetz` = '{get.ip}'","Stines-GmbH","") + if not result: + return False + else: + return result[0][0] @app.post("/host/set") async def sethost(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api_key)):