- Sort Score
- Result 10 results
- Languages All
Results 421 - 430 of 1,178 for strs (0.01 sec)
-
docs_src/schema_extra_example/tutorial001_pv1_py310.py
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 634 bytes - Viewed (0) -
docs/zh/docs/tutorial/dependencies/sub-dependencies.md
这段代码声明了类型为 `str` 的可选查询参数 `q`,然后返回这个查询参数。 这个函数很简单(不过也没什么用),但却有助于让我们专注于了解子依赖项的工作方式。 ### 第二层依赖项 接下来,创建另一个依赖项函数,并同时用该依赖项自身再声明一个依赖项(所以这也是一个「依赖项」): {* ../../docs_src/dependencies/tutorial005.py hl[13] *} 这里重点说明一下声明的参数: * 尽管该函数自身是依赖项,但还声明了另一个依赖项(它「依赖」于其他对象) * 该函数依赖 `query_extractor`, 并把 `query_extractor` 的返回值赋给参数 `q` * 同时,该函数还声明了类型是 `str` 的可选 cookie(`last_query`)Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 18 02:25:44 UTC 2024 - 3.2K bytes - Viewed (0) -
docs/zh/docs/tutorial/security/get-current-user.md
与之前直接在路径操作中的做法相同,新的 `get_current_user` 依赖项从子依赖项 `oauth2_scheme` 中接收 `str` 类型的 `token`: {* ../../docs_src/security/tutorial002.py hl[25] *} ## 获取用户 `get_current_user` 使用创建的(伪)工具函数,该函数接收 `str` 类型的令牌,并返回 Pydantic 的 `User` 模型: {* ../../docs_src/security/tutorial002.py hl[19:22,26:27] *} ## 注入当前用户 在*路径操作* 的 `Depends` 中使用 `get_current_user`: {* ../../docs_src/security/tutorial002.py hl[31] *}Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 18 02:25:44 UTC 2024 - 3.4K bytes - Viewed (0) -
docs_src/dependencies/tutorial008b_an_py39.py
def get_username(): try: yield "Rick" except OwnerError as e: raise HTTPException(status_code=400, detail=f"Owner error: {e}") @app.get("/items/{item_id}") def get_item(item_id: str, username: Annotated[str, Depends(get_username)]): if item_id not in data: raise HTTPException(status_code=404, detail="Item not found") item = data[item_id] if item["owner"] != username:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Dec 26 20:37:34 UTC 2023 - 775 bytes - Viewed (0) -
tests/test_tutorial/test_path_operation_configurations/test_tutorial003_tutorial004.py
pytest.param("tutorial004_py39"), pytest.param("tutorial004_py310", marks=needs_py310), ], ) def get_mod_name(request: pytest.FixtureRequest) -> str: return request.param @pytest.fixture(name="client") def get_client(mod_name: str) -> TestClient: mod = importlib.import_module(f"docs_src.path_operation_configuration.{mod_name}") return TestClient(mod.app)
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 7K bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial001_py39.py
from typing import Union from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None model_config = { "json_schema_extra": { "examples": [ { "name": "Foo", "description": "A very nice Item",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 684 bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial005_py310.py
from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None @app.put("/items/{item_id}") async def update_item( *, item_id: int, item: Item = Body( openapi_examples={ "normal": { "summary": "A normal example",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Aug 26 18:03:13 UTC 2023 - 1.3K bytes - Viewed (0) -
docs_src/bigger_applications/app_an_py39/routers/items.py
@router.get("/{item_id}") async def read_item(item_id: str): if item_id not in fake_items_db: raise HTTPException(status_code=404, detail="Item not found") return {"name": fake_items_db[item_id]["name"], "item_id": item_id} @router.put( "/{item_id}", tags=["custom"], responses={403: {"description": "Operation forbidden"}}, ) async def update_item(item_id: str): if item_id != "plumbus":
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 1011 bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial001_pv1_py39.py
from typing import Union from fastapi import FastAPI from pydantic.v1 import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None class Config: schema_extra = { "examples": [ { "name": "Foo", "description": "A very nice Item",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 672 bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial003_an_py39.py
from typing import Annotated, Union from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None @app.put("/items/{item_id}") async def update_item( item_id: int, item: Annotated[ Item, Body( examples=[ {
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 692 bytes - Viewed (0)