summaryrefslogtreecommitdiff
path: root/src/routers/scanner.py
diff options
context:
space:
mode:
authorKristofer Hallin <kristofer@sunet.se>2022-01-04 22:12:26 +0100
committerKristofer Hallin <kristofer@sunet.se>2022-01-04 22:12:26 +0100
commit2ea8d3a44d89934f7b22ddb932c76322601028a5 (patch)
tree84d210f850ea745f787cff403fcc553767b5c38c /src/routers/scanner.py
parenta3b5cde94981b9a98d367004b4c513c81e5870e4 (diff)
Use FastAPI routers and split things to multiple files.
Diffstat (limited to 'src/routers/scanner.py')
-rw-r--r--src/routers/scanner.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/routers/scanner.py b/src/routers/scanner.py
new file mode 100644
index 0000000..956153b
--- /dev/null
+++ b/src/routers/scanner.py
@@ -0,0 +1,16 @@
+from fastapi import APIRouter, Depends, Request
+from fastapi.responses import JSONResponse
+from fastapi_jwt_auth import AuthJWT
+
+router = APIRouter()
+
+
+@router.get('/callhome')
+async def callhome(data: Request, Authorize: AuthJWT = Depends()):
+ Authorize.jwt_required()
+
+ json_data = await data.json()
+
+ if 'uuid' not in json_data:
+ return JSONResponse(content={"status": "error",
+ "message": "UUID missing"})