Debian Codegraph @

docs_src/dependencies/tutorial001_py310.py

raw
1 from fastapi import Depends, FastAPI
2
3 app = FastAPI()
4
5
6 async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
7 return {"q": q, "skip": skip, "limit": limit}
8
9
10 @app.get("/items/")
11 async def read_items(commons: dict = Depends(common_parameters)):
12 return commons
13
14
15 @app.get("/users/")
16 async def read_users(commons: dict = Depends(common_parameters)):
17 return commons