Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 101 - 110 of 795 for asyncId (0.05 seconds)

  1. tests/test_stream_bare_type.py

    
    app = FastAPI()
    
    
    @app.get("/items/stream-bare-async")
    async def stream_bare_async() -> AsyncIterable:
        yield {"name": "foo"}
    
    
    @app.get("/items/stream-bare-sync")
    def stream_bare_sync() -> Iterable:
        yield {"name": "bar"}
    
    
    client = TestClient(app)
    
    
    def test_stream_bare_async_iterable():
        response = client.get("/items/stream-bare-async")
        assert response.status_code == 200
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 27 18:56:47 GMT 2026
    - 1.1K bytes
    - Click Count (0)
  2. fastapi/.agents/skills/fastapi/references/streaming.md

    # Streaming
    
    ## Stream JSON Lines
    
    To stream JSON Lines, declare the return type and use `yield` to return the data.
    
    ```python
    @app.get("/items/stream")
    async def stream_items() -> AsyncIterable[Item]:
        for item in items:
            yield item
    ```
    
    ## Server-Sent Events (SSE)
    
    To stream Server-Sent Events, use `response_class=EventSourceResponse` and `yield` items from the endpoint.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 10:05:57 GMT 2026
    - 2.5K bytes
    - Click Count (0)
  3. docs/en/docs/tutorial/dependencies/index.md

    ## To `async` or not to `async` { #to-async-or-not-to-async }
    
    As dependencies will also be called by **FastAPI** (the same as your *path operation functions*), the same rules apply while defining your functions.
    
    You can use `async def` or normal `def`.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 9.5K bytes
    - Click Count (0)
  4. docs/tr/docs/advanced/events.md

    Dikkat edilmesi gereken ilk şey, `yield` içeren async bir fonksiyon tanımlıyor olmamız. Bu, `yield` kullanan Dependencies’e oldukça benzer.
    
    {* ../../docs_src/events/tutorial003_py310.py hl[14:19] *}
    
    Fonksiyonun `yield`’den önceki kısmı, uygulama başlamadan **önce** çalışır.
    
    `yield`’den sonraki kısım ise, uygulama işini bitirdikten **sonra** çalışır.
    
    ### Async Context Manager { #async-context-manager }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 07:53:17 GMT 2026
    - 8.3K bytes
    - Click Count (0)
  5. docs_src/security/tutorial003_py310.py

        return user
    
    
    async def get_current_user(token: str = Depends(oauth2_scheme)):
        user = fake_decode_token(token)
        if not user:
            raise HTTPException(
                status_code=status.HTTP_401_UNAUTHORIZED,
                detail="Not authenticated",
                headers={"WWW-Authenticate": "Bearer"},
            )
        return user
    
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Nov 24 19:03:06 GMT 2025
    - 2.4K bytes
    - Click Count (0)
  6. src/test/java/jcifs/internal/smb2/ServerMessageBlock2ResponseTest.java

                    throw new RuntimeException(e);
                }
            }
    
            @Override
            public boolean isAsync() {
                return async;
            }
    
            public void setAsync(boolean async) {
                this.async = async;
            }
    
            @Override
            public boolean isRetainPayload() {
                return retainPayload;
            }
    
    Created: Sun Apr 05 00:10:12 GMT 2026
    - Last Modified: Thu Aug 14 05:31:44 GMT 2025
    - 19.3K bytes
    - Click Count (0)
  7. docs/zh-hant/docs/advanced/events.md

    ### Lifespan 函式 { #lifespan-function }
    
    首先要注意的是,我們定義了一個帶有 `yield` 的 async 函式。這和帶有 `yield` 的依賴(Dependencies)非常相似。
    
    {* ../../docs_src/events/tutorial003_py310.py hl[14:19] *}
    
    函式在 `yield` 之前的部分,會在應用啟動前先執行。
    
    `yield` 之後的部分,會在應用結束後再執行。
    
    ### 非同步內容管理器(Async Context Manager) { #async-context-manager }
    
    你會看到這個函式被 `@asynccontextmanager` 裝飾。
    
    它會把函式轉換成所謂的「**非同步內容管理器(async context manager)**」。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 7.2K bytes
    - Click Count (0)
  8. docs_src/dependency_testing/tutorial001_an_py310.py

    app = FastAPI()
    
    
    async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
        return {"q": q, "skip": skip, "limit": limit}
    
    
    @app.get("/items/")
    async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
        return {"message": "Hello Items!", "params": commons}
    
    
    @app.get("/users/")
    async def read_users(commons: Annotated[dict, Depends(common_parameters)]):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.5K bytes
    - Click Count (0)
  9. docs_src/dependencies/tutorial001_py310.py

    from fastapi import Depends, FastAPI
    
    app = FastAPI()
    
    
    async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100):
        return {"q": q, "skip": skip, "limit": limit}
    
    
    @app.get("/items/")
    async def read_items(commons: dict = Depends(common_parameters)):
        return commons
    
    
    @app.get("/users/")
    async def read_users(commons: dict = Depends(common_parameters)):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 404 bytes
    - Click Count (0)
  10. docs_src/path_operation_configuration/tutorial006_py310.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
        return [{"name": "Foo", "price": 42}]
    
    
    @app.get("/users/", tags=["users"])
    async def read_users():
        return [{"username": "johndoe"}]
    
    
    @app.get("/elements/", tags=["items"], deprecated=True)
    async def read_elements():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 365 bytes
    - Click Count (0)
Back to Top