Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for encodeUrl (0.23 sec)

  1. fastapi/encoders.py

        [FastAPI docs for JSON Compatible Encoder](https://fastapi.tiangolo.com/tutorial/encoder/).
        """
        custom_encoder = custom_encoder or {}
        if custom_encoder:
            if type(obj) in custom_encoder:
                return custom_encoder[type(obj)](obj)
            else:
                for encoder_type, encoder_instance in custom_encoder.items():
                    if isinstance(obj, encoder_type):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  2. tests/test_jsonable_encoder.py

        pet = {"name": "Firulais", "owner": {"name": "Foo"}}
        assert jsonable_encoder(pet) == {"name": "Firulais", "owner": {"name": "Foo"}}
        assert jsonable_encoder(pet, include={"name"}) == {"name": "Firulais"}
        assert jsonable_encoder(pet, exclude={"owner"}) == {"name": "Firulais"}
        assert jsonable_encoder(pet, include={}) == {}
        assert jsonable_encoder(pet, exclude={}) == {
            "name": "Firulais",
            "owner": {"name": "Foo"},
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 9K bytes
    - Viewed (0)
  3. docs/pt/docs/tutorial/encoder.md

    Você pode usar a função `jsonable_encoder` para resolver isso.
    
    A função recebe um objeto, como um modelo Pydantic e retorna uma versão compatível com JSON:
    
    === "Python 3.10+"
    
        ```Python hl_lines="4  21"
        {!> ../../../docs_src/encoder/tutorial001_py310.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="5  22"
        {!> ../../../docs_src/encoder/tutorial001.py!}
        ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  4. docs/uk/docs/tutorial/encoder.md

    # JSON Compatible Encoder
    
    Існують випадки, коли вам може знадобитися перетворити тип даних (наприклад, модель Pydantic) в щось сумісне з JSON (наприклад, `dict`, `list`, і т. д.).
    
    Наприклад, якщо вам потрібно зберегти це в базі даних.
    
    Для цього, **FastAPI** надає `jsonable_encoder()` функцію.
    
    ## Використання `jsonable_encoder`
    
    Давайте уявимо, що у вас є база даних `fake_db`, яка приймає лише дані, сумісні з JSON.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 2.6K bytes
    - Viewed (0)
  5. fastapi/openapi/utils.py

    )
    from fastapi.datastructures import DefaultPlaceholder
    from fastapi.dependencies.models import Dependant
    from fastapi.dependencies.utils import get_flat_dependant, get_flat_params
    from fastapi.encoders import jsonable_encoder
    from fastapi.openapi.constants import METHODS_WITH_BODY, REF_PREFIX, REF_TEMPLATE
    from fastapi.openapi.models import OpenAPI
    from fastapi.params import Body, Param
    from fastapi.responses import Response
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 21.8K bytes
    - Viewed (0)
  6. docs/en/mkdocs.yml

      - reference/middleware.md
      - OpenAPI:
        - reference/openapi/index.md
        - reference/openapi/docs.md
        - reference/openapi/models.md
      - reference/security/index.md
      - reference/encoders.md
      - reference/staticfiles.md
      - reference/templating.md
      - reference/testclient.md
    - fastapi-people.md
    - Resources:
      - resources/index.md
      - project-generation.md
      - external-links.md
    Others
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  7. docs/fr/docs/advanced/response-directly.md

    Par défaut, **FastAPI** convertirait automatiquement cette valeur de retour en JSON en utilisant le `jsonable_encoder` expliqué dans [JSON Compatible Encoder](../tutorial/encoder.md){.internal-link target=_blank}.
    
    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/zh/docs/tutorial/testing.md

    !!! info "信息"
        注意 `TestClient` 接收可以被转化为JSON的数据,而不是Pydantic模型。
    
        如果你在测试中有一个Pydantic模型,并且你想在测试时发送它的数据给应用,你可以使用在[JSON Compatible Encoder](encoder.md){.internal-link target=_blank}介绍的`jsonable_encoder` 。
    
    ## 运行起来
    
    之后,你只需要安装 `pytest`:
    
    <div class="termy">
    
    ```console
    $ pip install pytest
    
    ---> 100%
    ```
    
    </div>
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 6K bytes
    - Viewed (0)
  9. docs/en/docs/tutorial/testing.md

        If you have a Pydantic model in your test and you want to send its data to the application during testing, you can use the `jsonable_encoder` described in [JSON Compatible Encoder](encoder.md){.internal-link target=_blank}.
    
    ## Run it
    
    After that, you just need to install `pytest`:
    
    <div class="termy">
    
    ```console
    $ pip install pytest
    
    ---> 100%
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  10. docs/zh/docs/tutorial/body-updates.md

    # 请求体 - 更新数据
    
    ## 用 `PUT` 更新数据
    
    更新数据请用 <a href="https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Methods/PUT" class="external-link" target="_blank">HTTP `PUT`</a> 操作。
    
    把输入数据转换为以 JSON 格式存储的数据(比如,使用 NoSQL 数据库时),可以使用 `jsonable_encoder`。例如,把 `datetime` 转换为 `str`。
    
    ```Python hl_lines="30-35"
    {!../../../docs_src/body_updates/tutorial001.py!}
    ```
    
    `PUT` 用于接收替换现有数据的数据。
    
    ### 关于更新数据的警告
    
    用 `PUT` 把数据项 `bar` 更新为以下内容时:
    
    ```Python
    {
    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)
Back to top