Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 191 - 200 of 795 for asyncId (0.08 seconds)

  1. fastapi/middleware/asyncexitstack.py

        def __init__(
            self, app: ASGIApp, context_name: str = "fastapi_middleware_astack"
        ) -> None:
            self.app = app
            self.context_name = context_name
    
        async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
            async with AsyncExitStack() as stack:
                scope[self.context_name] = stack
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Sep 29 03:29:38 GMT 2025
    - 637 bytes
    - Click Count (0)
  2. tests/test_inherited_custom_class.py

        @property  # type: ignore
        def __class__(self):
            return uuid.UUID
    
        @property
        def __dict__(self):
            """Spoof a missing __dict__ by raising TypeError, this is how
            asyncpg.pgroto.pgproto.UUID behaves"""
            raise TypeError("vars() argument must have __dict__ attribute")
    
    
    def test_pydanticv2():
        from pydantic import field_serializer
    
        app = FastAPI()
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Dec 27 12:54:56 GMT 2025
    - 1.8K bytes
    - Click Count (0)
  3. docs/zh-hant/docs/tutorial/server-sent-events.md

    /// tip
    
    因為 Pydantic 會在 **Rust** 端進行序列化,如果你有宣告回傳型別,效能會比未宣告時高很多。
    
    ///
    
    ### 非 async 的路徑操作函式 { #non-async-path-operation-functions }
    
    你也可以使用一般的 `def` 函式(沒有 `async`),並同樣使用 `yield`。
    
    FastAPI 會確保正確執行,不會阻塞事件迴圈。
    
    由於此函式不是 async,正確的回傳型別是 `Iterable[Item]`:
    
    {* ../../docs_src/server_sent_events/tutorial001_py310.py ln[28:31] hl[29] *}
    
    ### 無回傳型別 { #no-return-type }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:33:04 GMT 2026
    - 4.6K bytes
    - Click Count (0)
  4. tests/test_starlette_exception.py

    
    @app.get("/items/{item_id}")
    async def read_item(item_id: str):
        if item_id not in items:
            raise HTTPException(
                status_code=404,
                detail="Item not found",
                headers={"X-Error": "Some custom header"},
            )
        return {"item": items[item_id]}
    
    
    @app.get("/http-no-body-statuscode-exception")
    async def no_body_status_code_exception():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 8.1K bytes
    - Click Count (0)
  5. docs/tr/docs/tutorial/stream-json-lines.md

    ///
    
    ### Async Olmayan path operation function'lar { #non-async-path-operation-functions }
    
    `async` olmadan normal `def` fonksiyonları da kullanabilir ve aynı şekilde `yield` yazabilirsiniz.
    
    FastAPI, event loop’u bloklamayacak şekilde doğru çalışmasını garanti eder.
    
    Bu durumda fonksiyon async olmadığı için doğru dönüş tipi `Iterable[Item]` olur:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:51:35 GMT 2026
    - 4.6K bytes
    - Click Count (0)
  6. tests/test_strict_content_type_router_level.py

    router_default = APIRouter(prefix="/default")
    
    
    @router_lax.post("/items/")
    async def router_lax_post(data: dict):
        return data
    
    
    @router_strict.post("/items/")
    async def router_strict_post(data: dict):
        return data
    
    
    @router_default.post("/items/")
    async def router_default_post(data: dict):
        return data
    
    
    app.include_router(router_lax)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Feb 23 17:45:20 GMT 2026
    - 1.7K bytes
    - Click Count (0)
  7. tests/test_dependency_pep695.py

    from fastapi.testclient import TestClient
    from typing_extensions import TypeAliasType
    
    
    async def some_value() -> int:
        return 123
    
    
    DependedValue = TypeAliasType(
        "DependedValue", Annotated[int, Depends(some_value)], type_params=()
    )
    
    
    def test_pep695_type_dependencies():
        app = FastAPI()
    
        @app.get("/")
        async def get_with_dep(value: DependedValue) -> str:  # noqa
            return f"value: {value}"
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 05 18:34:34 GMT 2026
    - 628 bytes
    - Click Count (0)
  8. docs_src/response_model/tutorial001_py310.py

        description: str | None = None
        price: float
        tax: float | None = None
        tags: list[str] = []
    
    
    @app.post("/items/", response_model=Item)
    async def create_item(item: Item) -> Any:
        return item
    
    
    @app.get("/items/", response_model=list[Item])
    async def read_items() -> Any:
        return [
            {"name": "Portal Gun", "price": 42.0},
            {"name": "Plumbus", "price": 32.0},
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Jan 07 13:45:48 GMT 2023
    - 537 bytes
    - Click Count (0)
  9. docs_src/response_model/tutorial005_py310.py

    }
    
    
    @app.get(
        "/items/{item_id}/name",
        response_model=Item,
        response_model_include={"name", "description"},
    )
    async def read_item_name(item_id: str):
        return items[item_id]
    
    
    @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude={"tax"})
    async def read_item_public_data(item_id: str):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 816 bytes
    - Click Count (0)
  10. docs/ru/docs/tutorial/request-files.md

    * `close()`: Закрыть файл.
    
    Поскольку все эти методы являются `async` методами, вам следует использовать "await" вместе с ними.
    
    Например, внутри `async` *функции операции пути* можно получить содержимое с помощью:
    
    ```Python
    contents = await myfile.read()
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:56:20 GMT 2026
    - 11.4K bytes
    - Click Count (0)
Back to Top