integrate/app/main.py

25 lines
709 B
Python

from fastapi import FastAPI, Request
from app.authentik.authentik import Authentik
from .wekan.api import Wekan
import json
app = FastAPI()
@app.get("/")
async def root():
return {'message': 'Hello World'}
@app.post("/authentik/hook")
async def hook(request: Request):
# print(await request.body())
r = await request.json()
# model_created = json.loads(r['body'].split("model_created: ")[1])["model"]
# hook wekan.create_user(model_created["pk"])
@app.get("/authentik/create_hook")
async def hook(request: Request):
a = Authentik(base="http://localhost:9000/", token="foobar123", hook_endpoint="http://172.17.0.1:8000/authentik/hook")
res = a.create_web_hook()
print(res)