☰
Debian Codegraph
@
0.141.1-2
0.141.1-1
0.135.3-1
/
/
docs_src
/
query_params
/
tutorial002_py310.py
☽
☼
docs_src/query_params/tutorial002_py310.py
code
plain
raw
Expat
(c) 2018 Sebastián RamÃrez
debian/copyright
1
from fastapi import FastAPI
2
3
app = FastAPI()
4
5
6
@app.get("/items/{item_id}")
7
async def read_item(item_id: str, q: str | None = None):
8
if q:
9
return {"item_id": item_id, "q": q}
10
return {"item_id": item_id}