mirror of https://github.com/tiangolo/fastapi.git
Remove code examples for Python 3.8 in `query_params`
This commit is contained in:
parent
41cef9621f
commit
2c6bc791d5
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
When you declare other function parameters that are not part of the path parameters, they are automatically interpreted as "query" parameters.
|
When you declare other function parameters that are not part of the path parameters, they are automatically interpreted as "query" parameters.
|
||||||
|
|
||||||
{* ../../docs_src/query_params/tutorial001.py hl[9] *}
|
{* ../../docs_src/query_params/tutorial001_py39.py hl[9] *}
|
||||||
|
|
||||||
The query is the set of key-value pairs that go after the `?` in a URL, separated by `&` characters.
|
The query is the set of key-value pairs that go after the `?` in a URL, separated by `&` characters.
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ If you don't want to add a specific value but just make it optional, set the def
|
||||||
|
|
||||||
But when you want to make a query parameter required, you can just not declare any default value:
|
But when you want to make a query parameter required, you can just not declare any default value:
|
||||||
|
|
||||||
{* ../../docs_src/query_params/tutorial005.py hl[6:7] *}
|
{* ../../docs_src/query_params/tutorial005_py39.py hl[6:7] *}
|
||||||
|
|
||||||
Here the query parameter `needy` is a required query parameter of type `str`.
|
Here the query parameter `needy` is a required query parameter of type `str`.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
from typing import Union
|
|
||||||
|
|
||||||
from fastapi import FastAPI
|
|
||||||
|
|
||||||
app = FastAPI()
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/items/{item_id}")
|
|
||||||
async def read_user_item(
|
|
||||||
item_id: str, needy: str, skip: int = 0, limit: Union[int, None] = None
|
|
||||||
):
|
|
||||||
item = {"item_id": item_id, "needy": needy, "skip": skip, "limit": limit}
|
|
||||||
return item
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from dirty_equals import IsDict
|
from dirty_equals import IsDict
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
from docs_src.query_params.tutorial005 import app
|
from docs_src.query_params.tutorial005_py39 import app
|
||||||
|
|
||||||
client = TestClient(app)
|
client = TestClient(app)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from ...utils import needs_py310
|
||||||
@pytest.fixture(
|
@pytest.fixture(
|
||||||
name="client",
|
name="client",
|
||||||
params=[
|
params=[
|
||||||
"tutorial006",
|
pytest.param("tutorial006_py39"),
|
||||||
pytest.param("tutorial006_py310", marks=needs_py310),
|
pytest.param("tutorial006_py310", marks=needs_py310),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue