mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-13 03:20:37 -04:00
✨ Add docs and tests for Python 3.9 and Python 3.10 (#3712)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
This commit is contained in:
committed by
GitHub
parent
83f6781037
commit
d08a062ee2
15
docs_src/query_params/tutorial003_py310.py
Normal file
15
docs_src/query_params/tutorial003_py310.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/items/{item_id}")
|
||||
async def read_item(item_id: str, q: str | None = None, short: bool = False):
|
||||
item = {"item_id": item_id}
|
||||
if q:
|
||||
item.update({"q": q})
|
||||
if not short:
|
||||
item.update(
|
||||
{"description": "This is an amazing item that has a long description"}
|
||||
)
|
||||
return item
|
||||
Reference in New Issue
Block a user