from fastapi import FastAPI, Request, HTTPException
import json
app = FastAPI()
@app.post("/endpoint")
async def receive_info(request: Request):
# lire le body brut
body = await request.body()
print(body)
# Parse le json
try:
data = json.loads(body)
except json.JSONDecodeEror :
raise HTTPException(status_code=400, detail="Invalid JSON")
# DEBUG
print("Infos reçus :", data)
return("status": "ok")