Search Options

Results per page
Sort
Preferred Languages
Advance

Results 931 - 940 of 1,169 for def2 (0.05 sec)

  1. docs_src/additional_status_codes/tutorial001.py

    from fastapi.responses import JSONResponse
    
    app = FastAPI()
    
    items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
    
    
    @app.put("/items/{item_id}")
    async def upsert_item(
        item_id: str,
        name: Union[str, None] = Body(default=None),
        size: Union[int, None] = Body(default=None),
    ):
        if item_id in items:
            item = items[item_id]
            item["name"] = name
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 684 bytes
    - Viewed (0)
  2. docs_src/additional_status_codes/tutorial001_an_py310.py

    from fastapi.responses import JSONResponse
    
    app = FastAPI()
    
    items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
    
    
    @app.put("/items/{item_id}")
    async def upsert_item(
        item_id: str,
        name: Annotated[str | None, Body()] = None,
        size: Annotated[int | None, Body()] = None,
    ):
        if item_id in items:
            item = items[item_id]
            item["name"] = name
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 686 bytes
    - Viewed (0)
  3. docs_src/body_multiple_params/tutorial001_an_py39.py

    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: Annotated[int, Path(title="The ID of the item to get", ge=0, le=1000)],
        q: Union[str, None] = None,
        item: Union[Item, None] = None,
    ):
        results = {"item_id": item_id}
        if q:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 610 bytes
    - Viewed (0)
  4. docs/ja/docs/tutorial/background-tasks.md

    **FastAPI** は、`BackgroundTasks` 型のオブジェクトを作成し、そのパラメーターに渡します。
    
    ## タスク関数の作成
    
    バックグラウンドタスクとして実行される関数を作成します。
    
    これは、パラメーターを受け取ることができる単なる標準的な関数です。
    
    これは `async def` または通常の `def` 関数であり、**FastAPI** はこれを正しく処理します。
    
    ここで、タスク関数はファイル書き込みを実行します (メール送信のシミュレーション)。
    
    また、書き込み操作では `async` と `await` を使用しないため、通常の `def` で関数を定義します。
    
    ```Python hl_lines="6-9"
    {!../../docs_src/background_tasks/tutorial001.py!}
    ```
    
    ## バックグラウンドタスクの追加
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6K bytes
    - Viewed (0)
  5. tests/test_operations_signatures.py

    import inspect
    
    from fastapi import APIRouter, FastAPI
    
    method_names = ["get", "put", "post", "delete", "options", "head", "patch", "trace"]
    
    
    def test_signatures_consistency():
        base_sig = inspect.signature(APIRouter.get)
        for method_name in method_names:
            router_method = getattr(APIRouter, method_name)
            app_method = getattr(FastAPI, method_name)
            router_sig = inspect.signature(router_method)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon May 27 12:08:13 UTC 2019
    - 934 bytes
    - Viewed (0)
  6. docs_src/python_types/tutorial008b_py310.py

    def process_item(item: int | str):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 51 bytes
    - Viewed (0)
  7. docs_src/metadata/tutorial001.py

            "email": "******@****.***",
        },
        license_info={
            "name": "Apache 2.0",
            "url": "https://www.apache.org/licenses/LICENSE-2.0.html",
        },
    )
    
    
    @app.get("/items/")
    async def read_items():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 805 bytes
    - Viewed (0)
  8. docs_src/path_operation_configuration/tutorial004.py

        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: Set[str] = set()
    
    
    @app.post("/items/", response_model=Item, summary="Create an item")
    async def create_item(item: Item):
        """
        Create an item with all the information:
    
        - **name**: each item must have a name
        - **description**: a long description
        - **price**: required
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 681 bytes
    - Viewed (0)
  9. docs_src/path_operation_configuration/tutorial005_py310.py

        tax: float | None = None
        tags: set[str] = set()
    
    
    @app.post(
        "/items/",
        response_model=Item,
        summary="Create an item",
        response_description="The created item",
    )
    async def create_item(item: Item):
        """
        Create an item with all the information:
    
        - **name**: each item must have a name
        - **description**: a long description
        - **price**: required
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 698 bytes
    - Viewed (0)
  10. docs_src/python_types/tutorial009c_py310.py

    def say_hi(name: str | None):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 56 bytes
    - Viewed (0)
Back to top