[FastAPI-43]RedirectResponse重定向
from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/")
def go_to_baidu():
return RedirectResponse("https://www.baidu.com")
from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/")
def go_to_baidu():
return RedirectResponse("https://www.baidu.com")