- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 36 for RedirectResponse (0.08 seconds)
-
docs_src/custom_response/tutorial006_py310.py
from fastapi import FastAPI from fastapi.responses import RedirectResponse app = FastAPI() @app.get("/typer") async def redirect_typer():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 199 bytes - Click Count (0) -
docs_src/response_model/tutorial003_03_py310.py
from fastapi import FastAPI from fastapi.responses import RedirectResponse app = FastAPI() @app.get("/teleport") async def get_teleport() -> RedirectResponse:
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 241 bytes - Click Count (0) -
docs_src/custom_response/tutorial006c_py310.py
from fastapi import FastAPI from fastapi.responses import RedirectResponse app = FastAPI() @app.get("/pydantic", response_class=RedirectResponse, status_code=302) async def redirect_pydantic():
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 237 bytes - Click Count (0) -
docs_src/response_model/tutorial003_05_py310.py
from fastapi import FastAPI, Response from fastapi.responses import RedirectResponse app = FastAPI() @app.get("/portal", response_model=None) async def get_portal(teleport: bool = False) -> Response | dict: if teleport: return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Jan 10 16:22:47 GMT 2023 - 373 bytes - Click Count (0) -
docs_src/response_model/tutorial003_04_py310.py
from fastapi import FastAPI, Response from fastapi.responses import RedirectResponse app = FastAPI() @app.get("/portal") async def get_portal(teleport: bool = False) -> Response | dict: if teleport: return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Jan 10 16:22:47 GMT 2023 - 352 bytes - Click Count (0) -
docs_src/response_model/tutorial003_02_py310.py
from fastapi import FastAPI, Response from fastapi.responses import JSONResponse, RedirectResponse app = FastAPI() @app.get("/portal") async def get_portal(teleport: bool = False) -> Response: if teleport: return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 381 bytes - Click Count (0) -
docs/en/docs/advanced/custom-response.md
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 11K bytes - Click Count (0) -
fastapi/responses.py
from starlette.responses import JSONResponse as JSONResponse # noqa from starlette.responses import PlainTextResponse as PlainTextResponse # noqa 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:
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 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) -
docs/zh-hant/docs/advanced/custom-response.md
/// note | 技術細節 但如果你宣告了回應模型或回傳型別,將會直接用它來把資料序列化為 JSON,並直接回傳具有正確 JSON media type 的回應,而不會使用 `JSONResponse` 類別。 這是取得最佳效能的理想方式。 /// ### `RedirectResponse` { #redirectresponse } 回傳一個 HTTP 重新導向。預設使用 307 狀態碼(Temporary Redirect)。 你可以直接回傳 `RedirectResponse`: {* ../../docs_src/custom_response/tutorial006_py310.py hl[2,9] *} --- 或者你可以在 `response_class` 參數中使用它:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 10.3K bytes - Click Count (0)