Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 22 for filme (0.01 sec)

  1. tests/test_tutorial/test_request_forms_and_files/test_tutorial001.py

            ]
        }
    
    
    def test_post_file_no_token(tmp_path, app: FastAPI):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
    
        client = TestClient(app)
        with path.open("rb") as file:
            response = client.post("/files/", files={"file": file})
        assert response.status_code == 422, response.text
        assert response.json() == {
            "detail": [
                {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 7.3K bytes
    - Viewed (0)
  2. tests/test_request_params/test_file/test_required.py

    import pytest
    from fastapi import FastAPI, File, UploadFile
    from fastapi.testclient import TestClient
    
    from .utils import get_body_model_name
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.post("/required-bytes", operation_id="required_bytes")
    async def read_required_bytes(p: Annotated[bytes, File()]):
        return {"file_size": len(p)}
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 10.8K bytes
    - Viewed (0)
  3. pyproject.toml

    [project.optional-dependencies]
    
    standard = [
        "fastapi-cli[standard] >=0.0.8",
        # For the test client
        "httpx >=0.23.0,<1.0.0",
        # For templates
        "jinja2 >=3.1.5",
        # For forms and file uploads
        "python-multipart >=0.0.18",
        # To validate email fields
        "email-validator >=2.0.0",
        # Uvicorn with uvloop
        "uvicorn[standard] >=0.12.0",
        # # Settings management
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 9.3K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_request_files/test_tutorial001.py

                    "loc": ["body", "file"],
                    "msg": "Field required",
                    "input": None,
                }
            ]
        }
    
    
    def test_post_file(tmp_path, client: TestClient):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
    
        with path.open("rb") as file:
            response = client.post("/files/", files={"file": file})
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 7.1K bytes
    - Viewed (0)
  5. tests/test_request_params/test_file/test_list.py

    async def read_list_bytes_alias(p: Annotated[list[bytes], File(alias="p_alias")]):
        return {"file_size": [len(file) for file in p]}
    
    
    @app.post("/list-uploadfile-alias", operation_id="list_uploadfile_alias")
    async def read_list_uploadfile_alias(
        p: Annotated[list[UploadFile], File(alias="p_alias")],
    ):
        return {"file_size": [file.size for file in p]}
    
    
    @pytest.mark.parametrize(
        "path",
        [
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:31:34 UTC 2025
    - 11.2K bytes
    - Viewed (0)
  6. tests/test_request_params/test_file/test_optional_list.py

        p: Annotated[Optional[list[bytes]], File(alias="p_alias")] = None,
    ):
        return {"file_size": [len(file) for file in p] if p else None}
    
    
    @app.post("/optional-list-uploadfile-alias")
    async def read_optional_list_uploadfile_alias(
        p: Annotated[Optional[list[UploadFile]], File(alias="p_alias")] = None,
    ):
        return {"file_size": [file.size for file in p] if p else None}
    
    
    @pytest.mark.parametrize(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 10.4K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_request_files/test_tutorial002.py

        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/",
                files=(
                    ("files", ("test.txt", file)),
                    ("files", ("test2.txt", file2)),
                ),
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 8.2K bytes
    - Viewed (0)
  8. tests/test_request_params/test_file/test_optional.py

    import pytest
    from fastapi import FastAPI, File, UploadFile
    from fastapi.testclient import TestClient
    
    from .utils import get_body_model_name
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.post("/optional-bytes", operation_id="optional_bytes")
    async def read_optional_bytes(p: Annotated[Optional[bytes], File()] = None):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 9.7K bytes
    - Viewed (0)
  9. fastapi/exceptions.py

    from starlette.exceptions import WebSocketException as StarletteWebSocketException
    
    
    class EndpointContext(TypedDict, total=False):
        function: str
        path: str
        file: str
        line: int
    
    
    class HTTPException(StarletteHTTPException):
        """
        An HTTP exception you can raise in your own code to show errors to the client.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 6.8K bytes
    - Viewed (0)
  10. fastapi/datastructures.py

        from fastapi import FastAPI, File, UploadFile
    
        app = FastAPI()
    
    
        @app.post("/files/")
        async def create_file(file: Annotated[bytes, File()]):
            return {"file_size": len(file)}
    
    
        @app.post("/uploadfile/")
        async def create_upload_file(file: UploadFile):
            return {"filename": file.filename}
        ```
        """
    
        file: Annotated[
            BinaryIO,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 5.1K bytes
    - Viewed (0)
Back to top