Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 37 for 2012 (0.15 sec)

  1. docs_src/response_model/tutorial004.py

        price: float
        tax: float = 10.5
        tags: List[str] = []
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
        "bar": {"name": "Bar", "description": "The bartenders", "price": 62, "tax": 20.2},
        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item, response_model_exclude_unset=True)
    async def read_item(item_id: str):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 633 bytes
    - Viewed (0)
  2. docs_src/body_updates/tutorial001_py39.py

        price: Union[float, None] = None
        tax: float = 10.5
        tags: list[str] = []
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
        "bar": {"name": "Bar", "description": "The bartenders", "price": 62, "tax": 20.2},
        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item)
    async def read_item(item_id: str):
        return items[item_id]
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 900 bytes
    - Viewed (0)
  3. docs_src/response_model/tutorial006.py

        description: Union[str, None] = None
        price: float
        tax: float = 10.5
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
        "bar": {"name": "Bar", "description": "The Bar fighters", "price": 62, "tax": 20.2},
        "baz": {
            "name": "Baz",
            "description": "There goes my baz",
            "price": 50.2,
            "tax": 10.5,
        },
    }
    
    
    @app.get(
        "/items/{item_id}/name",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 848 bytes
    - Viewed (0)
  4. docs/de/docs/tutorial/middleware.md

    Sie könnten beispielsweise einen benutzerdefinierten Header `X-Process-Time` hinzufügen, der die Zeit in Sekunden enthält, die benötigt wurde, um den Request zu verarbeiten und eine Response zu generieren:
    
    ```Python hl_lines="10  12-13"
    {!../../../docs_src/middleware/tutorial001.py!}
    ```
    
    ## Andere Middlewares
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 23 11:26:59 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  5. docs/en/docs/tutorial/middleware.md

    For example, you could add a custom header `X-Process-Time` containing the time in seconds that it took to process the request and generate a response:
    
    ```Python hl_lines="10  12-13"
    {!../../../docs_src/middleware/tutorial001.py!}
    ```
    
    ## Other middlewares
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 2.9K bytes
    - Viewed (0)
  6. docs/zh/docs/tutorial/middleware.md

    ### 在 `response` 的前和后
    
    在任何*路径操作*收到`request`前,可以添加要和请求一起运行的代码.
    
    也可以在*响应*生成但是返回之前添加代码.
    
    例如你可以添加自定义请求头 `X-Process-Time` 包含以秒为单位的接收请求和生成响应的时间:
    
    ```Python hl_lines="10  12-13"
    {!../../../docs_src/middleware/tutorial001.py!}
    ```
    
    ## 其他中间件
    
    你可以稍后在 [Advanced User Guide: Advanced Middleware](../advanced/middleware.md){.internal-link target=_blank}阅读更多关于中间件的教程.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 27 17:25:21 GMT 2021
    - 2.7K bytes
    - Viewed (0)
  7. docs/zh/docs/tutorial/body-updates.md

    ```
    
    `PUT` 用于接收替换现有数据的数据。
    
    ### 关于更新数据的警告
    
    用 `PUT` 把数据项 `bar` 更新为以下内容时:
    
    ```Python
    {
        "name": "Barz",
        "price": 3,
        "description": None,
    }
    ```
    
    因为上述数据未包含已存储的属性 `"tax": 20.2`,新的输入模型会把 `"tax": 10.5` 作为默认值。
    
    因此,本次操作把 `tax` 的值「更新」为 `10.5`。
    
    ## 用 `PATCH` 进行部分更新
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  8. docs/ja/docs/tutorial/middleware.md

    ### `response` の前後
    
    *path operation* が `request` を受け取る前に、 `request` とともに実行されるコードを追加できます。
    
    また `response` が生成された後、それを返す前にも追加できます。
    
    例えば、リクエストの処理とレスポンスの生成にかかった秒数を含むカスタムヘッダー `X-Process-Time` を追加できます:
    
    ```Python hl_lines="10  12-13"
    {!../../../docs_src/middleware/tutorial001.py!}
    ```
    
    ## その他のミドルウェア
    
    他のミドルウェアの詳細については、[高度なユーザーガイド: 高度なミドルウェア](../advanced/middleware.md){.internal-link target=_blank}を参照してください。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu May 12 00:06:16 GMT 2022
    - 3.8K bytes
    - Viewed (0)
  9. docs/zh/docs/tutorial/response-model.md

    #### 默认值字段有实际值的数据
    
    但是,如果你的数据在具有默认值的模型字段中有实际的值,例如 ID 为 `bar` 的项:
    
    ```Python hl_lines="3  5"
    {
        "name": "Bar",
        "description": "The bartenders",
        "price": 62,
        "tax": 20.2
    }
    ```
    
    这些值将包含在响应中。
    
    #### 具有与默认值相同值的数据
    
    如果数据具有与默认值相同的值,例如 ID 为 `baz` 的项:
    
    ```Python hl_lines="3  5-6"
    {
        "name": "Baz",
        "description": None,
        "price": 50.2,
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 7.9K bytes
    - Viewed (0)
  10. docs/ja/docs/tutorial/response-model.md

    #### デフォルト値を持つフィールドの値を持つデータ
    
    しかし、ID`bar`のitemのように、デフォルト値が設定されているモデルのフィールドに値が設定されている場合:
    
    ```Python hl_lines="3 5"
    {
        "name": "Bar",
        "description": "The bartenders",
        "price": 62,
        "tax": 20.2
    }
    ```
    
    それらはレスポンスに含まれます。
    
    #### デフォルト値と同じ値を持つデータ
    
    ID`baz`のitemのようにデフォルト値と同じ値を持つデータの場合:
    
    ```Python hl_lines="3 5 6"
    {
        "name": "Baz",
        "description": None,
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.3K bytes
    - Viewed (0)
Back to top