Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 797 for orjson (0.18 sec)

  1. tests/test_orjson_response_class.py

    app = FastAPI(default_response_class=ORJSONResponse)
    
    
    @app.get("/orjson_non_str_keys")
    def get_orjson_non_str_keys():
        key = quoted_name(value="msg", quote=False)
        return {key: "Hello World", 1: 1}
    
    
    client = TestClient(app)
    
    
    def test_orjson_non_str_keys():
        with client:
            response = client.get("/orjson_non_str_keys")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Sep 02 10:17:31 GMT 2022
    - 562 bytes
    - Viewed (0)
  2. tests/test_default_response_class.py

    )
    
    
    client = TestClient(app)
    
    orjson_type = "application/x-orjson"
    text_type = "text/plain; charset=utf-8"
    html_type = "text/html; charset=utf-8"
    override_type = "application/x-override"
    
    
    def test_app():
        with client:
            response = client.get("/")
        assert response.json() == {"msg": "Hello World"}
        assert response.headers["content-type"] == orjson_type
    
    
    def test_app_override():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Mar 01 20:49:20 GMT 2020
    - 5.2K bytes
    - Viewed (0)
  3. docs_src/custom_response/tutorial009c.py

    from typing import Any
    
    import orjson
    from fastapi import FastAPI, Response
    
    app = FastAPI()
    
    
    class CustomORJSONResponse(Response):
        media_type = "application/json"
    
        def render(self, content: Any) -> bytes:
            assert orjson is not None, "orjson must be installed"
            return orjson.dumps(content, option=orjson.OPT_INDENT_2)
    
    
    @app.get("/", response_class=CustomORJSONResponse)
    async def main():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Sep 01 09:32:30 GMT 2022
    - 451 bytes
    - Viewed (0)
  4. fastapi/responses.py

        """
    
        def render(self, content: Any) -> bytes:
            assert orjson is not None, "orjson must be installed to use ORJSONResponse"
            return orjson.dumps(
                content, option=orjson.OPT_NON_STR_KEYS | orjson.OPT_SERIALIZE_NUMPY
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 1.7K bytes
    - Viewed (0)
  5. docs/zh/docs/advanced/custom-response.md

    ### `JSONResponse`
    
    接受数据并返回一个 `application/json` 编码的响应。
    
    如上文所述,这是 **FastAPI** 中使用的默认响应。
    
    ### `ORJSONResponse`
    
    如上文所述,`ORJSONResponse` 是一个使用 <a href="https://github.com/ijl/orjson" class="external-link" target="_blank">`orjson`</a> 的快速的可选 JSON 响应。
    
    
    ### `UJSONResponse`
    
    `UJSONResponse` 是一个使用 <a href="https://github.com/ultrajson/ultrajson" class="external-link" target="_blank">`ujson`</a> 的可选 JSON 响应。
    
    !!! warning "警告"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu May 12 00:06:16 GMT 2022
    - 7.8K bytes
    - Viewed (1)
  6. requirements-tests.txt

    sqlalchemy >=1.3.18,<1.4.43
    databases[sqlite] >=0.3.2,<0.7.0
    orjson >=3.2.1,<4.0.0
    ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0
    python-multipart >=0.0.7,<0.1.0
    flask >=1.1.2,<3.0.0
    anyio[trio] >=3.2.1,<4.0.0
    python-jose[cryptography] >=3.3.0,<4.0.0
    pyyaml >=5.3.1,<7.0.0
    passlib[bcrypt] >=1.7.2,<2.0.0
    
    # types
    types-ujson ==5.7.0.1
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 671 bytes
    - Viewed (0)
  7. docs/de/docs/advanced/custom-response.md

    Nehmen wir zum Beispiel an, dass Sie <a href="https://github.com/ijl/orjson" class="external-link" target="_blank">`orjson`</a> verwenden möchten, aber mit einigen benutzerdefinierten Einstellungen, die in der enthaltenen `ORJSONResponse`-Klasse nicht verwendet werden.
    
    Sie möchten etwa, dass Ihre Response eingerücktes und formatiertes JSON zurückgibt. Dafür möchten Sie die orjson-Option `orjson.OPT_INDENT_2` verwenden.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 23 13:05:12 GMT 2024
    - 13.5K bytes
    - Viewed (0)
  8. docs/en/docs/advanced/custom-response.md

    For example, let's say that you want to use <a href="https://github.com/ijl/orjson" class="external-link" target="_blank">`orjson`</a>, but with some custom settings not used in the included `ORJSONResponse` class.
    
    Let's say you want it to return indented and formatted JSON, so you want to use the orjson option `orjson.OPT_INDENT_2`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.7K bytes
    - Viewed (0)
  9. docs/em/docs/advanced/custom-response.md

    ## 🛃 📨 🎓
    
    👆 💪 ✍ 👆 👍 🛃 📨 🎓, 😖 ⚪️➡️ `Response` &amp; ⚙️ ⚫️.
    
    🖼, ➡️ 💬 👈 👆 💚 ⚙️ <a href="https://github.com/ijl/orjson" class="external-link" target="_blank">`orjson`</a>, ✋️ ⏮️ 🛃 ⚒ 🚫 ⚙️ 🔌 `ORJSONResponse` 🎓.
    
    ➡️ 💬 👆 💚 ⚫️ 📨 🔂 &amp; 📁 🎻, 👆 💚 ⚙️ Orjson 🎛 `orjson.OPT_INDENT_2`.
    
    👆 💪 ✍ `CustomORJSONResponse`. 👑 👜 👆 ✔️ ✍ `Response.render(content)` 👩‍🔬 👈 📨 🎚 `bytes`:
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 9.8K bytes
    - Viewed (0)
  10. docs/ja/docs/advanced/custom-response.md

    ### `JSONResponse`
    
    データを受け取り、 `application/json` としてエンコードされたレスポンスを返します。
    
    上で読んだように、**FastAPI** のデフォルトのレスポンスとして利用されます。
    
    ### `ORJSONResponse`
    
    上で読んだように、<a href="https://github.com/ijl/orjson" class="external-link" target="_blank">`orjson`</a>を使った、高速な代替のJSONレスポンスです。
    
    ### `UJSONResponse`
    
    <a href="https://github.com/ultrajson/ultrajson" class="external-link" target="_blank">`ujson`</a>を使った、代替のJSONレスポンスです。
    
    !!! warning "注意"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Jul 19 19:14:58 GMT 2021
    - 10.7K bytes
    - Viewed (0)
Back to top