diff --git a/main.py b/main.py index 486a26c..021b8ae 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,9 @@ import enum -from typing import List, Optional +from typing import Any, List, Optional import httpx from fastapi import FastAPI, HTTPException -from fastapi.params import Header +from fastapi.params import Header, Path from pydantic import BaseModel app = FastAPI() @@ -31,10 +31,18 @@ class Passages(BaseModel): passages: List[Passage] -# Stop id can be optained using -# https://data.grandlyon.com/jeux-de-donnees/points-arret-reseau-transports-commun-lyonnais/donnees @app.get("/stop/{stop_id}", response_model=Passages) -async def stop(stop_id: int, authorization: Optional[str] = Header(None)): +async def stop( + stop_id: int = Path( + None, + description="Stop id to monitor. Can be obtained using https://data.grandlyon.com/jeux-de-donnees/points-arret-reseau-transports-commun-lyonnais/donnees", + ), + authorization: Optional[str] = Header( + None, + alias="Authorization", + description="Basic auth for remote API (data grand lyon)", + ), +): if authorization is None: raise HTTPException(status_code=401, detail="Not authenticated")