- Sort Score
- Num 10 results
- Language All
Results 11 - 20 of 53 for StreamingResponse (0.11 seconds)
-
docs_src/dependencies/tutorial013_an_py310.py
import time from typing import Annotated from fastapi import Depends, FastAPI, HTTPException from fastapi.responses import StreamingResponse from sqlmodel import Field, Session, SQLModel, create_engine engine = create_engine("postgresql+psycopg://postgres:postgres@localhost/db") class User(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str app = FastAPI() def get_session():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Mon Sep 29 03:29:38 GMT 2025 - 937 bytes - Click Count (0) -
docs_src/dependencies/tutorial014_an_py310.py
import time from typing import Annotated from fastapi import Depends, FastAPI, HTTPException from fastapi.responses import StreamingResponse from sqlmodel import Field, Session, SQLModel, create_engine engine = create_engine("postgresql+psycopg://postgres:postgres@localhost/db") class User(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str app = FastAPI() def get_session():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Mon Sep 29 03:29:38 GMT 2025 - 957 bytes - Click Count (0) -
docs/ja/docs/advanced/stream-data.md
同様に、動画や音声をストリームすることもできます。処理しながら生成し、そのまま送信することも可能です。 ## `yield` を使った `StreamingResponse` { #a-streamingresponse-with-yield } path operation 関数で `response_class=StreamingResponse` を宣言すると、`yield` を使ってデータをチャンクごとに順次送信できます。 {* ../../docs_src/stream_data/tutorial001_py310.py ln[1:23] hl[20,23] *} FastAPI は各データチャンクをそのまま `StreamingResponse` に渡し、JSON などに変換しようとはしません。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:55:22 GMT 2026 - 6.7K bytes - Click Count (0) -
docs/en/docs/advanced/advanced-dependencies.md
### Dependencies with `yield` and `StreamingResponse`, Technical Details { #dependencies-with-yield-and-streamingresponse-technical-details } Before FastAPI 0.118.0, if you used a dependency with `yield`, it would run the exit code after the *path operation function* returned but right before sending the response.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 9K bytes - Click Count (0) -
tests/test_stream_cancellation.py
import anyio import pytest from fastapi import FastAPI from fastapi.responses import StreamingResponse pytestmark = [ pytest.mark.anyio, pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning"), ] app = FastAPI() @app.get("/stream-raw", response_class=StreamingResponse) async def stream_raw() -> AsyncIterable[str]:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Feb 27 18:56:47 GMT 2026 - 2.7K bytes - Click Count (0) -
fastapi/responses.py
from starlette.responses import RedirectResponse as RedirectResponse # noqa from starlette.responses import Response as Response # noqa from starlette.responses import StreamingResponse as StreamingResponse # noqa from typing_extensions import deprecated try: import ujson except ImportError: # pragma: nocover ujson = None # type: ignore try: import orjsonCreated: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 09:21:52 GMT 2026 - 3.6K bytes - Click Count (0) -
docs/ja/docs/advanced/advanced-dependencies.md
### `yield` と `StreamingResponse` を伴う依存関係、技術詳細 { #dependencies-with-yield-and-streamingresponse-technical-details } FastAPI 0.118.0 より前では、`yield` を使う依存関係を使用すると、*path operation 関数* が戻ってからレスポンス送信直前に終了コードが実行されていました。 これは、レスポンスがネットワーク上を移動するのを待っている間に、不要にリソースを保持しないようにする意図でした。 この変更により、`StreamingResponse` を返す場合、`yield` を持つ依存関係の終了コードはすでに実行されていることになりました。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 11.4K bytes - Click Count (0) -
docs/en/docs/reference/responses.md
```python from fastapi.responses import ( FileResponse, HTMLResponse, JSONResponse, ORJSONResponse, PlainTextResponse, RedirectResponse, Response, StreamingResponse, UJSONResponse, ) ``` ## FastAPI Responses There were a couple of custom FastAPI response classes that were intended to optimize JSON performance.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 22 16:34:59 GMT 2026 - 4.4K bytes - Click Count (0) -
fastapi/sse.py
from typing import Annotated, Any from annotated_doc import Doc from pydantic import AfterValidator, BaseModel, Field, model_validator from starlette.responses import StreamingResponse # Canonical SSE event schema matching the OpenAPI 3.2 spec # (Section 4.14.4 "Special Considerations for Server-Sent Events") _SSE_EVENT_SCHEMA: dict[str, Any] = { "type": "object", "properties": { "data": {"type": "string"},
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 01 09:21:52 GMT 2026 - 6.2K bytes - Click Count (0) -
tests/test_dependency_contextmanager.py
import json import pytest from fastapi import BackgroundTasks, Depends, FastAPI from fastapi.responses import StreamingResponse from fastapi.testclient import TestClient app = FastAPI() state = { "/async": "asyncgen not started", "/sync": "generator not started", "/async_raise": "asyncgen raise not started", "/sync_raise": "generator raise not started", "context_a": "not started a", "context_b": "not started b",
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 11.5K bytes - Click Count (0)