Search Options

Results per page
Sort
Preferred Languages
Advance

Results 481 - 490 of 1,977 for Fastapi (0.05 sec)

  1. docs_src/request_files/tutorial001_03_an.py

    from fastapi import FastAPI, File, UploadFile
    from typing_extensions import Annotated
    
    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
    - 431 bytes
    - Viewed (0)
  2. docs_src/response_model/tutorial003_py310.py

    from typing import Any
    
    from fastapi import FastAPI
    from pydantic import BaseModel, EmailStr
    
    app = FastAPI()
    
    
    class UserIn(BaseModel):
        username: str
        password: str
        email: EmailStr
        full_name: str | None = None
    
    
    class UserOut(BaseModel):
        username: str
        email: EmailStr
        full_name: str | None = None
    
    
    @app.post("/user/", response_model=UserOut)
    async def create_user(user: UserIn) -> Any:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Jan 07 13:45:48 UTC 2023
    - 431 bytes
    - Viewed (0)
  3. docs_src/separate_openapi_schemas/tutorial001_py310.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
    
    
    app = FastAPI()
    
    
    @app.post("/items/")
    def create_item(item: Item):
        return item
    
    
    @app.get("/items/")
    def read_items() -> list[Item]:
        return [
            Item(
                name="Portal Gun",
                description="Device to travel through the multi-rick-verse",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Aug 25 19:10:22 UTC 2023
    - 451 bytes
    - Viewed (0)
  4. docs/zh/docs/contributing.md

    ---> 100%
    ```
    
    </div>
    
    这将在虚拟环境中安装所有依赖和本地版本的 FastAPI。
    
    #### 使用本地 FastAPI
    
    如果你创建一个导入并使用 FastAPI 的 Python 文件,然后使用虚拟环境中的 Python 运行它,它将使用你本地的 FastAPI 源码。
    
    并且如果你更改该本地 FastAPI 的源码,由于它是通过 `-e` 安装的,当你再次运行那个 Python 文件,它将使用你刚刚编辑过的最新版本的 FastAPI。
    
    这样,你不必再去重新"安装"你的本地版本即可测试所有更改。
    
    /// note | "技术细节"
    
    仅当你使用此项目中的 `requirements.txt` 安装而不是直接使用 `pip install fastapi` 安装时,才会发生这种情况。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Aug 06 04:48:30 UTC 2024
    - 12.8K bytes
    - Viewed (0)
  5. docs/en/docs/tutorial/query-params-str-validations.md

    It will already be installed with FastAPI.
    
    ```Python hl_lines="3-4"
    {!> ../../docs_src/query_params_str_validations/tutorial002_an.py!}
    ```
    
    ////
    
    /// info
    
    FastAPI added support for `Annotated` (and started recommending it) in version 0.95.0.
    
    If you have an older version, you would get errors when trying to use `Annotated`.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 25.4K bytes
    - Viewed (0)
  6. docs/pt/docs/tutorial/background-tasks.md

    Ela é importada/incluída diretamente no FastAPI para que você possa importá-la do `fastapi` e evitar a importação acidental da alternativa `BackgroundTask` (sem o `s` no final) de `starlette.background`.
    
    Usando apenas `BackgroundTasks` (e não `BackgroundTask`), é então possível usá-la como um parâmetro de _função de operação de caminho_ e deixar o **FastAPI** cuidar do resto para você, assim como ao usar o objeto `Request` diretamente.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.3K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/background-tasks.md

    It is imported/included directly into FastAPI so that you can import it from `fastapi` and avoid accidentally importing the alternative `BackgroundTask` (without the `s` at the end) from `starlette.background`.
    
    By only using `BackgroundTasks` (and not `BackgroundTask`), it's then possible to use it as a *path operation function* parameter and have **FastAPI** handle the rest for you, just like when using the `Request` object directly.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 15:22:48 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  8. fastapi/responses.py

    
    class UJSONResponse(JSONResponse):
        """
        JSON response using the high-performance ujson library to serialize data to JSON.
    
        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"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 18 12:36:40 UTC 2023
    - 1.7K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_header_params/test_tutorial002_an.py

                200,
                {"strange_header": "FastAPI test"},
            ),
            (
                "/items",
                {"strange-header": "Not really underscore"},
                200,
                {"strange_header": None},
            ),
        ],
    )
    def test(path, headers, expected_status, expected_response):
        response = client.get(path, headers=headers)
        assert response.status_code == expected_status
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 4K bytes
    - Viewed (0)
  10. docs_src/separate_openapi_schemas/tutorial002_py310.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
    
    
    app = FastAPI(separate_input_output_schemas=False)
    
    
    @app.post("/items/")
    def create_item(item: Item):
        return item
    
    
    @app.get("/items/")
    def read_items() -> list[Item]:
        return [
            Item(
                name="Portal Gun",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Aug 25 19:10:22 UTC 2023
    - 486 bytes
    - Viewed (0)
Back to top