fastapi文档加锁

  1. Install
pip install 'fastapi-cdn-host>=0.5.2'
  1. Code
import fastapi_cdn_host
from fastapi import FastAPI

app = FastAPI(
  openapi_url="/api/v1/openapi.json",# 定制该URL,防止别人通过http://my.domain.com/openapi.json来访问文档
)
fastapi_cdn_host.patch_docs(app, lock=fastapi_cdn_host.weekday_lock)
  1. 效果:
    https://blog.csdn.net/jaket5219999/article/details/139833098
posted @ 2024-06-20 15:12  waketzheng  阅读(24)  评论(0编辑  收藏  举报