Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 268 for item (0.12 sec)

  1. docs/fr/docs/deployment/docker.md

    from typing import Optional
    
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Optional[str] = None):
        return {"item_id": item_id, "q": q}
    ```
    
    * Vous devriez maintenant avoir une structure de répertoire telle que :
    
    ```
    .
    ├── app
    │   └── main.py
    └── Dockerfile
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 12 00:06:16 GMT 2022
    - 7.5K bytes
    - Viewed (0)
  2. docs/fr/docs/tutorial/query-params-str-validations.md

    Imaginez que vous vouliez que votre paramètre se nomme `item-query`.
    
    Comme dans la requête :
    
    ```
    http://127.0.0.1:8000/items/?item-query=foobaritems
    ```
    
    Mais `item-query` n'est pas un nom de variable valide en Python.
    
    Le nom le plus proche serait `item_query`.
    
    Mais vous avez vraiment envie que ce soit exactement `item-query`...
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jul 27 18:53:21 GMT 2023
    - 9.8K bytes
    - Viewed (0)
  3. docs/em/docs/tutorial/handling-errors.md

    ```
    
    ### 📉 📨
    
    🚥 👩‍💻 📨 `http://example.com/items/foo` ( `item_id` `"foo"`), 👈 👩‍💻 🔜 📨 🇺🇸🔍 👔 📟 2️⃣0️⃣0️⃣, & 🎻 📨:
    
    ```JSON
    {
      "item": "The Foo Wrestlers"
    }
    ```
    
    ✋️ 🚥 👩‍💻 📨 `http://example.com/items/bar` (🚫-🚫 `item_id` `"bar"`), 👈 👩‍💻 🔜 📨 🇺🇸🔍 👔 📟 4️⃣0️⃣4️⃣ ("🚫 🔎" ❌), & 🎻 📨:
    
    ```JSON
    {
      "detail": "Item not found"
    }
    ```
    
    !!! tip
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.3K bytes
    - Viewed (0)
  4. docs/ja/docs/tutorial/handling-errors.md

    ```
    
    ### レスポンス結果
    
    クライアントが`http://example.com/items/foo`(`item_id` `"foo"`)をリクエストすると、HTTPステータスコードが200で、以下のJSONレスポンスが返されます:
    
    ```JSON
    {
      "item": "The Foo Wrestlers"
    }
    ```
    
    しかし、クライアントが`http://example.com/items/bar`(存在しない`item_id` `"bar"`)をリクエストした場合、HTTPステータスコード404("not found"エラー)と以下のJSONレスポンスが返されます:
    
    ```JSON
    {
      "detail": "Item not found"
    }
    ```
    
    !!! tip "豆知識"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 11.8K bytes
    - Viewed (0)
  5. docs/zh/docs/tutorial/sql-databases.md

        有关更多详细信息,请返回教程中的安全部分。
    
        在这里,我们只关注数据库的工具和机制。
    
    !!! tip
        这里不是将每个关键字参数传递给Item并从Pydantic模型中读取每个参数,而是先生成一个字典,其中包含Pydantic模型的数据:
    
        `item.dict()`
    
        然后我们将dict的键值对 作为关键字参数传递给 SQLAlchemy `Item`:
    
        `Item(**item.dict())`
    
        然后我们传递 Pydantic模型未提供的额外关键字参数`owner_id`:
    
        `Item(**item.dict(), owner_id=user_id)`
    
    ## 主**FastAPI**应用程序
    
    现在在`sql_app/main.py`文件中 让我们集成和使用我们之前创建的所有其他部分。
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 27K bytes
    - Viewed (0)
  6. docs/em/docs/tutorial/path-params-numeric-validations.md

        ```Python hl_lines="1"
        {!> ../../../docs_src/path_params_numeric_validations/tutorial001_py310.py!}
        ```
    
    ## 📣 🗃
    
    👆 💪 📣 🌐 🎏 🔢 `Query`.
    
    🖼, 📣 `title` 🗃 💲 ➡ 🔢 `item_id` 👆 💪 🆎:
    
    === "🐍 3️⃣.6️⃣ & 🔛"
    
        ```Python hl_lines="10"
        {!> ../../../docs_src/path_params_numeric_validations/tutorial001.py!}
        ```
    
    === "🐍 3️⃣.1️⃣0️⃣ & 🔛"
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 4.4K bytes
    - Viewed (0)
  7. docs/zh/docs/tutorial/body-updates.md

    更新部分数据时,可以在 Pydantic 模型的 `.dict()` 中使用 `exclude_unset` 参数。
    
    比如,`item.dict(exclude_unset=True)`。
    
    这段代码生成的 `dict` 只包含创建 `item` 模型时显式设置的数据,而不包括默认值。
    
    然后再用它生成一个只含已设置(在请求中所发送)数据,且省略了默认值的 `dict`:
    
    ```Python hl_lines="34"
    {!../../../docs_src/body_updates/tutorial002.py!}
    ```
    
    ### 使用 Pydantic 的 `update` 参数
    
    接下来,用 `.copy()` 为已有模型创建调用 `update` 参数的副本,该参数为包含更新数据的 `dict`。
    
    例如,`stored_item_model.copy(update=update_data)`:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  8. docs/en/docs/advanced/dataclasses.md

    3. The `Author` dataclass includes a list of `Item` dataclasses.
    
    4. The `Author` dataclass is used as the `response_model` parameter.
    
    5. You can use other standard type annotations with dataclasses as the request body.
    
        In this case, it's a list of `Item` dataclasses.
    
    6. Here we are returning a dictionary that contains `items` which is a list of dataclasses.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  9. docs/hu/docs/index.md

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: Union[bool, None] = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Union[str, None] = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    def update_item(item_id: int, item: Item):
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Apr 29 05:18:04 GMT 2024
    - 20.2K bytes
    - Viewed (0)
  10. docs/es/docs/index.md

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: Union[bool, None] = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Union[str, None] = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    def update_item(item_id: int, item: Item):
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Apr 29 05:18:04 GMT 2024
    - 19K bytes
    - Viewed (0)
Back to top