Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 148 for Bytes (0.14 sec)

  1. tests/test_multipart_installation.py

                return f  # pragma: nocover
    
    
    def test_incorrect_multipart_installed_file_bytes(monkeypatch):
        monkeypatch.delattr("multipart.multipart.parse_options_header", raising=False)
        with pytest.raises(RuntimeError, match=multipart_incorrect_install_error):
            app = FastAPI()
    
            @app.post("/")
            async def root(f: bytes = File()):
                return f  # pragma: nocover
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 3.7K bytes
    - Viewed (0)
  2. fastapi/responses.py

        Read more about it in the
        [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/).
        """
    
        def render(self, content: Any) -> bytes:
            assert ujson is not None, "ujson must be installed to use UJSONResponse"
            return ujson.dumps(content, ensure_ascii=False).encode("utf-8")
    
    
    class ORJSONResponse(JSONResponse):
        """
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 1.7K bytes
    - Viewed (0)
  3. fastapi/_compat.py

            return field_annotation_is_scalar_sequence(field.field_info.annotation)
    
        def is_bytes_field(field: ModelField) -> bool:
            return is_bytes_or_nonable_bytes_annotation(field.type_)
    
        def is_bytes_sequence_field(field: ModelField) -> bool:
            return is_bytes_sequence_annotation(field.type_)
    
        def copy_field_info(*, field_info: FieldInfo, annotation: Any) -> FieldInfo:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 22.6K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_request_files/test_tutorial003_an_py39.py

                "type": "value_error.missing",
            }
        ]
    }
    
    
    @needs_py39
    def test_post_files(tmp_path, app: FastAPI):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
        path2 = tmp_path / "test2.txt"
        path2.write_bytes(b"<file content2>")
    
        client = TestClient(app)
        with path.open("rb") as file, path2.open("rb") as file2:
            response = client.post(
                "/files/",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.6K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_request_files/test_tutorial001_03_an_py39.py

        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
    
        with path.open("rb") as file:
            response = client.post("/files/", files={"file": file})
        assert response.status_code == 200, response.text
        assert response.json() == {"file_size": 14}
    
    
    @needs_py39
    def test_post_upload_file(tmp_path, client: TestClient):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 6.2K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_custom_response/test_tutorial009.py

    client = TestClient(app)
    
    
    def test_get(tmp_path: Path):
        file_path: Path = tmp_path / "large-video-file.mp4"
        tutorial009.some_file_path = str(file_path)
        test_content = b"Fake video bytes"
        file_path.write_bytes(test_content)
        response = client.get("/")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Jul 03 19:51:28 GMT 2021
    - 487 bytes
    - Viewed (0)
  7. tests/test_tutorial/test_custom_response/test_tutorial009b.py

    client = TestClient(app)
    
    
    def test_get(tmp_path: Path):
        file_path: Path = tmp_path / "large-video-file.mp4"
        tutorial009b.some_file_path = str(file_path)
        test_content = b"Fake video bytes"
        file_path.write_bytes(test_content)
        response = client.get("/")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Jul 03 19:51:28 GMT 2021
    - 490 bytes
    - Viewed (0)
  8. docs/uk/docs/tutorial/extra-data-types.md

            * У відповідях, `set` буде перетворений на `list`.
            * Згенерована схема буде вказувати, що значення `set` є унікальними (з використанням JSON Schema's `uniqueItems`).
    * `bytes`:
        * Стандартний Пайтонівський `bytes`.
        * У запитах і відповідях це буде оброблено як `str`.
        * Згенерована схема буде вказувати, що це `str` з "форматом" `binary`.
    * `Decimal`:
        * Стандартний Пайтонівський `Decimal`.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 5.8K bytes
    - Viewed (0)
  9. docs/de/docs/tutorial/request-files.md

    Die Dateien werden als „Formulardaten“ hochgeladen.
    
    Wenn Sie den Typ Ihrer *Pfadoperation-Funktion* als `bytes` deklarieren, wird **FastAPI** die Datei für Sie auslesen, und Sie erhalten den Inhalt als `bytes`.
    
    Bedenken Sie, dass das bedeutet, dass sich der gesamte Inhalt der Datei im Arbeitsspeicher befindet. Das wird für kleinere Dateien gut funktionieren.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 17:58:08 GMT 2024
    - 11.5K bytes
    - Viewed (0)
  10. docs/de/docs/advanced/custom-response.md

    ```Python hl_lines="1  18"
    {!../../../docs_src/response_directly/tutorial002.py!}
    ```
    
    ### `HTMLResponse`
    
    Nimmt Text oder Bytes entgegen und gibt eine HTML-Response zurück, wie Sie oben gelesen haben.
    
    ### `PlainTextResponse`
    
    Nimmt Text oder Bytes entgegen und gibt eine Plain-Text-Response zurück.
    
    ```Python hl_lines="2  7  9"
    {!../../../docs_src/custom_response/tutorial005.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 23 13:05:12 GMT 2024
    - 13.5K bytes
    - Viewed (0)
Back to top