This repository has been archived on 2026-02-12. You can view files and clone it, but cannot push or open issues or pull requests.
old-grabber/app.py
2026-01-15 23:25:46 +01:00

20 lines
461 B
Python

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)
# Parser le JSON
try:
data = json.loads(body)
except json.JSONDecodeError:
raise HTTPException(status_code=400, detail="Invalid JSON")
# Debug
print("Infos recues :", data)
return {"status": "ok"}