Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 73 for upload_file (0.06 sec)

  1. docs/en/docs/tutorial/request-files.md

    But there are several cases in which you might benefit from using `UploadFile`.
    
    ## File Parameters with `UploadFile`
    
    Define a file parameter with a type of `UploadFile`:
    
    //// tab | Python 3.9+
    
    ```Python hl_lines="14"
    {!> ../../docs_src/request_files/tutorial001_an_py39.py!}
    ```
    
    ////
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 10.2K bytes
    - Viewed (0)
  2. docs/em/docs/tutorial/request-files.md

    โœ”๏ธ ๐Ÿคฏ ๐Ÿ‘ˆ ๐Ÿ‘‰ โ›“ ๐Ÿ‘ˆ ๐ŸŽ‚ ๐ŸŽš ๐Ÿ”œ ๐Ÿช ๐Ÿ’พ. ๐Ÿ‘‰ ๐Ÿ”œ ๐Ÿ‘ท ๐Ÿ‘ ๐Ÿคช ๐Ÿ“.
    
    โœ‹๏ธ ๐Ÿ“ค ๐Ÿ“š ๐Ÿ’ผ โ” ๐Ÿ‘† ๐Ÿ’ช ๐Ÿ’ฐ โšช๏ธโžก๏ธ โš™๏ธ `UploadFile`.
    
    ## ๐Ÿ“ ๐Ÿ”ข โฎ๏ธ `UploadFile`
    
    ๐Ÿ”ฌ ๐Ÿ“ ๐Ÿ”ข โฎ๏ธ ๐Ÿ†Ž `UploadFile`:
    
    ```Python hl_lines="12"
    {!../../docs_src/request_files/tutorial001.py!}
    ```
    
    โš™๏ธ `UploadFile` โœ”๏ธ ๐Ÿ“š ๐Ÿ“ˆ ๐Ÿคญ `bytes`:
    
    * ๐Ÿ‘† ๐Ÿšซ โœ”๏ธ โš™๏ธ `File()` ๐Ÿ”ข ๐Ÿ’ฒ ๐Ÿ”ข.
    * โšซ๏ธ โš™๏ธ "๐Ÿงต" ๐Ÿ“:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.6K bytes
    - Viewed (0)
  3. docs/de/docs/tutorial/request-files.md

    Aber es gibt viele Fรคlle, in denen Sie davon profitieren, `UploadFile` zu verwenden.
    
    ## Datei-Parameter mit `UploadFile`
    
    Definieren Sie einen Datei-Parameter mit dem Typ `UploadFile`:
    
    //// tab | Python 3.9+
    
    ```Python hl_lines="14"
    {!> ../../docs_src/request_files/tutorial001_an_py39.py!}
    ```
    
    ////
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 11.3K bytes
    - Viewed (0)
  4. docs/pt/docs/tutorial/request_files.md

    Mas existem vรกrios casos em que vocรช pode se beneficiar ao usar `UploadFile`.
    
    ## Parรขmetros de arquivo com `UploadFile`
    
    Defina um parรขmetro de arquivo com o tipo `UploadFile`
    
    //// tab | Python 3.9+
    
    ```Python hl_lines="14"
    {!> ../../docs_src/request_files/tutorial001_an_py39.py!}
    ```
    
    ////
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 10.8K bytes
    - Viewed (0)
  5. docs_src/request_files/tutorial001_03_an_py39.py

    from typing import Annotated
    
    from fastapi import FastAPI, File, UploadFile
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(file: Annotated[bytes, File(description="A file read as bytes")]):
        return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(
        file: Annotated[UploadFile, File(description="A file read as UploadFile")],
    ):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 421 bytes
    - Viewed (0)
  6. tests/test_multipart_installation.py

    import warnings
    
    import pytest
    from fastapi import FastAPI, File, Form, UploadFile
    from fastapi.dependencies.utils import (
        multipart_incorrect_install_error,
        multipart_not_installed_error,
    )
    
    
    def test_incorrect_multipart_installed_form(monkeypatch):
        monkeypatch.setattr("python_multipart.__version__", "0.0.12")
        with warnings.catch_warnings(record=True):
            warnings.simplefilter("always")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 21:46:26 UTC 2024
    - 5.7K bytes
    - Viewed (0)
  7. tests/test_compat.py

        # For coverage
        # TODO: in theory this would allow declaring types that could be lists of UploadFile
        # and other types, but I'm not even sure it's a good idea to support it as a first
        # class "feature"
        assert is_uploadfile_sequence_annotation(Union[List[str], List[UploadFile]])
    
    
    def test_is_pv1_scalar_field():
        # For coverage
        class Model(BaseModel):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Sep 11 07:45:30 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  8. tests/test_datastructures.py

        app = FastAPI()
    
        testing_file_store: List[UploadFile] = []
    
        @app.post("/uploadfile/")
        def create_upload_file(file: UploadFile):
            testing_file_store.append(file)
            return {"filename": file.filename}
    
        client = TestClient(app)
        with path.open("rb") as file:
            response = client.post("/uploadfile/", files={"file": file})
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 18 12:36:40 UTC 2023
    - 2K bytes
    - Viewed (0)
  9. docs_src/request_files/tutorial001_02_an_py310.py

    from typing import Annotated
    
    from fastapi import FastAPI, File, UploadFile
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(file: Annotated[bytes | None, File()] = None):
        if not file:
            return {"message": "No file sent"}
        else:
            return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(file: UploadFile | None = None):
        if not file:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 505 bytes
    - Viewed (0)
  10. tests/test_tutorial/test_request_files/test_tutorial001_03_an.py

    
    def test_post_upload_file(tmp_path):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
    
        client = TestClient(app)
        with path.open("rb") as file:
            response = client.post("/uploadfile/", files={"file": file})
        assert response.status_code == 200, response.text
        assert response.json() == {"filename": "test.txt"}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 6K bytes
    - Viewed (0)
Back to top