Search Options

Results per page
Sort
Preferred Languages
Advance

Results 111 - 120 of 1,962 for fastapi (1.13 sec)

  1. docs_src/custom_request_and_route/tutorial002.py

    from typing import Callable, List
    
    from fastapi import Body, FastAPI, HTTPException, Request, Response
    from fastapi.exceptions import RequestValidationError
    from fastapi.routing import APIRoute
    
    
    class ValidationErrorLoggingRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                try:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 932 bytes
    - Viewed (0)
  2. tests/test_empty_router.py

    import pytest
    from fastapi import APIRouter, FastAPI
    from fastapi.exceptions import FastAPIError
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    router = APIRouter()
    
    
    @router.get("")
    def get_empty():
        return ["OK"]
    
    
    app.include_router(router, prefix="/prefix")
    
    
    client = TestClient(app)
    
    
    def test_use_empty():
        with client:
            response = client.get("/prefix")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Jun 11 22:37:34 UTC 2023
    - 805 bytes
    - Viewed (0)
  3. tests/test_router_redirect_slashes.py

    from fastapi import APIRouter, FastAPI
    from fastapi.testclient import TestClient
    
    
    def test_redirect_slashes_enabled():
        app = FastAPI()
        router = APIRouter()
    
        @router.get("/hello/")
        def hello_page() -> str:
            return "Hello, World!"
    
        app.include_router(router)
    
        client = TestClient(app)
    
        response = client.get("/hello/", follow_redirects=False)
        assert response.status_code == 200
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Jun 22 10:37:50 UTC 2023
    - 974 bytes
    - Viewed (0)
  4. docs/zh/docs/project-generation.md

    # FastAPI全栈模板
    
    模板通常带有特定的设置,而且被设计为灵活和可定制的。这允许您根据项目的需求修改和调整它们,使它们成为一个很好的起点。🏁
    
    您可以使用此模板开始,因为它包含了许多已经为您完成的初始设置、安全性、数据库和一些API端点。
    
    代码仓: <a href="https://github.com/fastapi/full-stack-fastapi-template" class="external-link" target="_blank">Full Stack FastAPI Template</a>
    
    ## FastAPI全栈模板 - 技术栈和特性
    
    - ⚡ [**FastAPI**](https://fastapi.tiangolo.com) 用于Python后端API.
        - 🧰 [SQLModel](https://sqlmodel.tiangolo.com) 用于Python和SQL数据库的集成(ORM)。
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Oct 04 11:16:34 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  5. docs/zh-hant/docs/tutorial/index.md

    **強烈建議**你編寫或複製程式碼、進行修改並在本地端運行。
    
    在編輯器中使用它,才能真正體會到 FastAPI 的好處,可以看到你只需編寫少量程式碼,以及所有的型別檢查、自動補齊等功能。
    
    ---
    
    ## 安裝 FastAPI
    
    第一步是安裝 FastAPI。
    
    確保你建立一個[虛擬環境](../virtual-environments.md){.internal-link target=_blank},啟用它,然後**安裝 FastAPI**:
    
    <div class="termy">
    
    ```console
    $ pip install "fastapi[standard]"
    
    ---> 100%
    ```
    
    </div>
    
    /// note
    
    當你使用 `pip install "fastapi[standard]"` 安裝時,會包含一些預設的可選標準相依項。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Oct 24 18:28:00 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  6. docs/zh/docs/tutorial/dependencies/index.md

    注意,无需创建专门的类,并将之传递给 **FastAPI** 以进行「注册」或执行类似的操作。
    
    只要把它传递给 `Depends`,**FastAPI** 就知道该如何执行后续操作。
    
    ///
    
    ## 要不要使用 `async`?
    
    **FastAPI** 调用依赖项的方式与*路径操作函数*一样,因此,定义依赖项函数,也要应用与路径操作函数相同的规则。
    
    即,既可以使用异步的 `async def`,也可以使用普通的 `def` 定义依赖项。
    
    在普通的 `def` *路径操作函数*中,可以声明异步的 `async def` 依赖项;也可以在异步的 `async def` *路径操作函数*中声明普通的 `def` 依赖项。
    
    上述这些操作都是可行的,**FastAPI** 知道该怎么处理。
    
    /// note | "笔记"
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 7K bytes
    - Viewed (0)
  7. tests/test_include_route.py

    from fastapi import APIRouter, FastAPI, Request
    from fastapi.responses import JSONResponse
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    router = APIRouter()
    
    
    @router.route("/items/")
    def read_items(request: Request):
        return JSONResponse({"hello": "world"})
    
    
    app.include_router(router)
    
    client = TestClient(app)
    
    
    def test_sub_router():
        response = client.get("/items/")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Apr 08 04:37:38 UTC 2020
    - 496 bytes
    - Viewed (0)
  8. docs/en/docs/advanced/generate-clients.md

    Some of them also ✨ [**sponsor FastAPI**](../help-fastapi.md#sponsor-the-author){.internal-link target=_blank} ✨, this ensures the continued and healthy **development** of FastAPI and its **ecosystem**.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 10.7K bytes
    - Viewed (0)
  9. docs/em/docs/advanced/middleware.md

    app = SomeASGIApp()
    
    new_app = UnicornMiddleware(app, some_config="rainbow")
    ```
    
    ✋️ FastAPI (🤙 💃) 🚚 🙅 🌌 ⚫️ 👈 ⚒ 💭 👈 🔗 🛠️ 🍵 💽 ❌ &amp; 🛃 ⚠ 🐕‍🦺 👷 ☑.
    
    👈, 👆 ⚙️ `app.add_middleware()` (🖼 ⚜).
    
    ```Python
    from fastapi import FastAPI
    from unicorn import UnicornMiddleware
    
    app = FastAPI()
    
    app.add_middleware(UnicornMiddleware, some_config="rainbow")
    ```
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  10. docs_src/response_directly/tutorial001.py

    from datetime import datetime
    from typing import Union
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from fastapi.responses import JSONResponse
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        title: str
        timestamp: datetime
        description: Union[str, None] = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{id}")
    def update_item(id: str, item: Item):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 505 bytes
    - Viewed (0)
Back to top