Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 225 for init (0.21 sec)

  1. docs/zh/docs/index.md

    
    @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):
        return {"item_name": item.name, "item_id": item_id}
    ```
    
    服务器将会自动重载(因为在上面的步骤中你向 `uvicorn` 命令添加了 `--reload` 选项)。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Apr 29 05:18:04 GMT 2024
    - 18.2K bytes
    - Viewed (0)
  2. docs/ru/docs/python-types.md

    ```Python hl_lines="1  4"
    {!../../../docs_src/python_types/tutorial007.py!}
    ```
    
    Это означает:
    
    * Переменная `items_t` является `tuple` с 3 элементами: `int`, другим `int` и `str`.
    * Переменная `items_s` является `set` и каждый элемент имеет тип `bytes`.
    
    #### `Dict`
    
    Чтобы определить `dict`, вы передаёте 2 параметра типов, разделённых запятыми.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 14.6K bytes
    - Viewed (0)
  3. docs/ru/docs/tutorial/path-params.md

                "type": "type_error.integer"
            }
        ]
    }
    ```
    
    из-за того, что параметр пути `item_id` имеет значение `"foo"`, которое не является типом  `int`.
    
    Та же ошибка возникнет, если вместо `int` передать `float` , например: <a href="http://127.0.0.1:8000/items/4.2" class="external-link" target="_blank">http://127.0.0.1:8000/items/4.2</a>
    
    !!! check "Заметка"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  4. docs/zh/docs/tutorial/path-params.md

    ```
    
    本例把 `item_id` 的类型声明为 `int`。
    
    !!! check "检查"
    
        类型声明将为函数提供错误检查、代码补全等编辑器支持。
    
    ## 数据<abbr title="也称为:序列化、解析">转换</abbr>
    
    运行示例并访问 <a href="http://127.0.0.1:8000/items/3" class="external-link" target="_blank">http://127.0.0.1:8000/items/3</a>,返回的响应如下:
    
    ```JSON
    {"item_id":3}
    ```
    
    !!! check "检查"
    
        注意,函数接收并返回的值是 `3`( `int`),不是 `"3"`(`str`)。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Apr 01 05:35:40 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_query_params/test_tutorial006_py310.py

                    },
                    {
                        "type": "int_parsing",
                        "loc": ["query", "skip"],
                        "msg": "Input should be a valid integer, unable to parse string as an integer",
                        "input": "a",
                    },
                    {
                        "type": "int_parsing",
                        "loc": ["query", "limit"],
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  6. docs/de/docs/tutorial/body-nested-models.md

    ---
    
    Ein anderer nützlicher Anwendungsfall ist, wenn Sie Schlüssel eines anderen Typs haben wollen, z. B. `int`.
    
    Das schauen wir uns mal an.
    
    Im folgenden Beispiel akzeptieren Sie irgendein `dict`, solange es `int`-Schlüssel und `float`-Werte hat.
    
    === "Python 3.9+"
    
        ```Python hl_lines="7"
        {!> ../../../docs_src/body_nested_models/tutorial009_py39.py!}
        ```
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 10.4K bytes
    - Viewed (0)
  7. docs/fr/docs/tutorial/path-params.md

    
    ```Python hl_lines="7"
    {!../../../docs_src/path_params/tutorial002.py!}
    ```
    
    Ici, `item_id` est déclaré comme `int`.
    
    !!! check "vérifier"
        Ceci vous permettra d'obtenir des fonctionnalités de l'éditeur dans votre fonction, telles
        que des vérifications d'erreur, de l'auto-complétion, etc.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 10K bytes
    - Viewed (0)
  8. fastapi/utils.py

    # Cache for `create_cloned_field`
    _CLONED_TYPES_CACHE: MutableMapping[
        Type[BaseModel], Type[BaseModel]
    ] = WeakKeyDictionary()
    
    
    def is_body_allowed_for_status_code(status_code: Union[int, str, None]) -> bool:
        if status_code is None:
            return True
        # Ref: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#patterned-fields-1
        if status_code in {
            "default",
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_handling_errors/test_tutorial005.py

        assert response.status_code == 422, response.text
        assert response.json() == IsDict(
            {
                "detail": [
                    {
                        "type": "int_parsing",
                        "loc": ["body", "size"],
                        "msg": "Input should be a valid integer, unable to parse string as an integer",
                        "input": "XL",
                    }
                ],
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 4.3K bytes
    - Viewed (0)
  10. fastapi/security/open_id_connect_url.py

    from typing_extensions import Annotated, Doc
    
    
    class OpenIdConnect(SecurityBase):
        """
        OpenID Connect authentication class. An instance of it would be used as a
        dependency.
        """
    
        def __init__(
            self,
            *,
            openIdConnectUrl: Annotated[
                str,
                Doc(
                    """
                The OpenID Connect URL.
                """
                ),
            ],
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 2.7K bytes
    - Viewed (0)
Back to top