This commit is contained in:
Casper da Costa-Luis 2026-02-04 17:36:50 +00:00 committed by GitHub
commit 30aa5beccb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -217,7 +217,7 @@ You can also use the `status_code` parameter combined with the `response_class`
Takes an async generator or a normal generator/iterator and streams the response body.
{* ../../docs_src/custom_response/tutorial007_py39.py hl[2,14] *}
{* ../../docs_src/custom_response/tutorial007_py39.py hl[4,17] *}
#### Using `StreamingResponse` with file-like objects { #using-streamingresponse-with-file-like-objects }

View File

@ -1,3 +1,5 @@
import asyncio
from fastapi import FastAPI
from fastapi.responses import StreamingResponse
@ -7,6 +9,7 @@ app = FastAPI()
async def fake_video_streamer():
for i in range(10):
yield b"some fake video bytes"
await asyncio.sleep(0.1)
@app.get("/")