- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 43 for FileResponse (0.06 seconds)
-
docs_src/additional_responses/tutorial004_py310.py
from fastapi import FastAPI from fastapi.responses import FileResponse from pydantic import BaseModel class Item(BaseModel): id: str value: str responses = { 404: {"description": "Item not found"}, 302: {"description": "The item was moved"}, 403: {"description": "Not enough privileges"}, } app = FastAPI() @app.get( "/items/{item_id}", response_model=Item,
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 669 bytes - Click Count (0) -
docs_src/additional_responses/tutorial002_py310.py
from fastapi import FastAPI from fastapi.responses import FileResponse from pydantic import BaseModel class Item(BaseModel): id: str value: str app = FastAPI() @app.get( "/items/{item_id}", response_model=Item, responses={ 200: { "content": {"image/png": {}}, "description": "Return the JSON item or an image.", } }, )
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 596 bytes - Click Count (0) -
docs/en/docs/advanced/json-base64-bytes.md
## Base64 vs Files { #base64-vs-files } Consider first if you can use [Request Files](../tutorial/request-files.md) for uploading binary data and [Custom Response - FileResponse](./custom-response.md#fileresponse--fileresponse-) for sending binary data, instead of encoding it in JSON. JSON can only contain UTF-8 encoded strings, so it can't contain raw bytes.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 2.4K bytes - Click Count (0) -
docs_src/custom_response/tutorial009_py310.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 202 bytes - Click Count (0) -
docs_src/custom_response/tutorial009b_py310.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 217 bytes - Click Count (0) -
docs/zh-hant/docs/advanced/json-base64-bytes.md
如果你的應用需要收發 JSON 資料,但其中需要包含二進位資料,你可以將它以 base64 編碼。 ## Base64 與檔案 { #base64-vs-files } 請先考慮是否能用 [請求檔案](../tutorial/request-files.md) 來上傳二進位資料,並用 [自訂回應 - FileResponse](./custom-response.md#fileresponse--fileresponse-) 來傳送二進位資料,而不是把它們編碼進 JSON。 JSON 只能包含 UTF-8 編碼的字串,因此無法直接包含原始位元組。 Base64 可以把二進位資料編碼成字串,但為此會使用比原始二進位資料更多的字元,因此通常比直接使用檔案來得沒那麼有效率。 只有在確實必須把二進位資料包含在 JSON 裡,且無法改用檔案時,才使用 base64。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:33:04 GMT 2026 - 2.4K bytes - Click Count (0) -
docs/zh/docs/advanced/json-base64-bytes.md
如果你的应用需要接收和发送 JSON 数据,但其中需要包含二进制数据,可以将其编码为 base64。 ## Base64 与文件 { #base64-vs-files } 请先考虑是否可以使用 [请求文件](../tutorial/request-files.md) 来上传二进制数据,并使用 [自定义响应 - FileResponse](./custom-response.md#fileresponse--fileresponse-) 来发送二进制数据,而不是把它编码进 JSON。 JSON 只能包含 UTF-8 编码的字符串,因此无法直接包含原始字节。 Base64 可以把二进制数据编码为字符串,但为此会使用比原始二进制更多的字符,因此通常比直接使用文件的效率更低。 仅当你确实需要在 JSON 中包含二进制数据且无法使用文件时,才使用 base64。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:29:48 GMT 2026 - 2.4K bytes - Click Count (0) -
docs/ja/docs/advanced/json-base64-bytes.md
## Base64 とファイル { #base64-vs-files } バイナリデータのアップロードにはまず、JSON にエンコードする代わりに [Request Files](../tutorial/request-files.md) を、バイナリデータの送信には [カスタムレスポンス - FileResponse](./custom-response.md#fileresponse--fileresponse-) を使えるか検討してください。 JSON は UTF-8 でエンコードされた文字列のみを含められるため、生のバイト列は含められません。 Base64 はバイナリデータを文字列にエンコードできますが、そのために元のバイナリより多くの文字を使用する必要があり、通常は通常のファイルより非効率です。Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:55:22 GMT 2026 - 3.1K bytes - Click Count (0) -
fastapi/responses.py
from typing import Any from fastapi.exceptions import FastAPIDeprecationWarning from fastapi.sse import EventSourceResponse as EventSourceResponse # noqa from starlette.responses import FileResponse as FileResponse # noqa from starlette.responses import HTMLResponse as HTMLResponse # noqa from starlette.responses import JSONResponse as JSONResponse # noqa from starlette.responses import PlainTextResponse as PlainTextResponse # noqa
Created: 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/en/docs/reference/responses.md
You can import them directly from `fastapi.responses`: ```python from fastapi.responses import ( FileResponse, HTMLResponse, JSONResponse, ORJSONResponse, PlainTextResponse, RedirectResponse, Response, StreamingResponse, UJSONResponse, ) ``` ## FastAPI Responses
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)