Results of 1 - 2 of about 2 for StreamingResponse (0.001 sec.)
- カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス 11228
- カスタムレスポンス - HTML、ストリーム、ファイル、その他のレスポンス デフォルトでは、 FastAPI は JSONResponse を使ってレスポンスを返します。 レスポンスを直接返す で見たように、 Response を直接返すことでこの挙動をオーバーライドできます。 しか
...= FastAPI () @app . get ( "/typer" ) async def redirect_typer (): return RedirectResponse ( "https://typer.tiangolo.com" ) StreamingResponse 非同期なジェネレータか通常のジェネレータ・イテレータを受け取り、レスポンスボディをストリームします。 Python 3.8+ from fast...api import FastAPI from fastapi.responses import StreamingResponse app = FastAPI () async def fake_video_streamer (): for i in range ( 10 ): yield b "some fake video bytes" @app . get ( "/"...) async def main (): return StreamingResponse ( fake_video_streamer ()) StreamingResponse をファイルライクなオブジェクトとともに使う ファイルライクなオブジェクト (例えば... - https://man.mtool.work/fastapi/0.115/advanced/custom-response/
- Custom Response Classes - File, HTML, Redirect, Streaming, etc. 7485
- Custom Response Classes - File, HTML, Redirect, Streaming, etc. There are several custom response classes you can use to create an instance and return them directly from your path operations . Read more about it in the FastAPI docs for Cust
...s import ( FileResponse , HTMLResponse , JSONResponse , ORJSONResponse , PlainTextResponse , RedirectResponse , Response , StreamingResponse , UJSONResponse , ) FastAPI Responses There are a couple of custom FastAPI response classes, you can use them to optimize...ype - body - background - raw_headers - render - init_headers - headers - set_cookie - delete_cookie ::: fastapi.responses.StreamingResponse options: members: - body_iterator - charset - status_code - media_type - body - background - raw_headers - render - init_h... - https://man.mtool.work/fastapi/0.115/reference/responses/
PREV
1
NEXT