FastAPI 开发 RESTAPI 实践
@app.get("/", response_class=HTMLResponse, include_in_schema=False)
async def index():
# 需要过滤的路由
filted_routes = [
"/openapi.json",
"/docs",
"/docs/oauth2-redirect",
"/redoc",
"/static",
"/"
]
routes = []
for route in app.routes:
if route.path not in filted_routes:
// ...
pip install markdown
使用
from markdown import markdown
print(markdown("# Title"))
<h1>Title</h1>