from typing import Optional from pydantic import BaseModel from fastapi import FastAPI app = FastAPI() class Sonde(BaseModel): identifiant: str nom: str @app.get("/") def read_root(): return {"msg": "Hello World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: Optional[str] = None): return {"item_id": item_id, "q": q} @app.post("/sonde/") def post_sonde(sonde: Sonde): print(sonde) return