Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 67 for upload_file (0.19 sec)

  1. tests/test_tutorial/test_request_files/test_tutorial001_03.py

                                "format": "binary",
                            }
                        },
                    },
                    "Body_create_upload_file_uploadfile__post": {
                        "title": "Body_create_upload_file_uploadfile__post",
                        "required": ["file"],
                        "type": "object",
                        "properties": {
                            "file": {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 6K bytes
    - Viewed (0)
  2. docs_src/request_files/tutorial001_02_py310.py

    from fastapi import FastAPI, File, UploadFile
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(file: bytes | None = File(default=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:
            return {"message": "No upload file sent"}
        else:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 470 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_request_files/test_tutorial001_02_an.py

                            )
                        },
                    },
                    "Body_create_upload_file_uploadfile__post": {
                        "title": "Body_create_upload_file_uploadfile__post",
                        "type": "object",
                        "properties": {
                            "file": IsDict(
                                {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 8.2K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_request_files/test_tutorial001_03_an.py

                                "format": "binary",
                            }
                        },
                    },
                    "Body_create_upload_file_uploadfile__post": {
                        "title": "Body_create_upload_file_uploadfile__post",
                        "required": ["file"],
                        "type": "object",
                        "properties": {
                            "file": {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 6K bytes
    - Viewed (0)
  5. tests/test_compat.py

        field_info = FieldInfo(annotation=str)
        field = ModelField(name="foo", field_info=field_info)
        assert field.default is Undefined
    
    
    @needs_pydanticv1
    def test_upload_file_dummy_with_info_plain_validator_function():
        # For coverage
        assert UploadFile.__get_pydantic_core_schema__(str, lambda x: None) == {}
    
    
    @needs_pydanticv1
    def test_union_scalar_list():
        # For coverage
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  6. tests/test_datastructures.py

    from typing import List
    
    import pytest
    from fastapi import FastAPI, UploadFile
    from fastapi.datastructures import Default
    from fastapi.testclient import TestClient
    
    
    # TODO: remove when deprecating Pydantic v1
    def test_upload_file_invalid():
        with pytest.raises(ValueError):
            UploadFile.validate("not a Starlette UploadFile")
    
    
    def test_upload_file_invalid_pydantic_v2():
        with pytest.raises(ValueError):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 2K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_request_files/test_tutorial001_03_an_py39.py

                                "format": "binary",
                            }
                        },
                    },
                    "Body_create_upload_file_uploadfile__post": {
                        "title": "Body_create_upload_file_uploadfile__post",
                        "required": ["file"],
                        "type": "object",
                        "properties": {
                            "file": {
    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)
  8. tests/test_tutorial/test_request_files/test_tutorial003.py

    
    def test_post_upload_file(tmp_path):
        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(
                "/uploadfiles/",
                files=(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.1K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_request_files/test_tutorial001_02_an_py310.py

                            )
                        },
                    },
                    "Body_create_upload_file_uploadfile__post": {
                        "title": "Body_create_upload_file_uploadfile__post",
                        "type": "object",
                        "properties": {
                            "file": IsDict(
                                {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 8.5K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_request_files/test_tutorial001_02_an_py39.py

                            )
                        },
                    },
                    "Body_create_upload_file_uploadfile__post": {
                        "title": "Body_create_upload_file_uploadfile__post",
                        "type": "object",
                        "properties": {
                            "file": IsDict(
                                {
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 8.5K bytes
    - Viewed (0)
Back to top