FastAPI之嵌套依赖注入
作者:互联网
from fastapi import Depends def query(q:Optional[str] = None): return q def sub_query(q: str = Depends(query), last_query: Optionnal[str] = None): if not q: return q return last_query @app05.get('/sub_dependency') def sub_dependency(final_query: str = Depends(sub_query, use_cache=True)): return {'sub_dependency': final_query}
标签:依赖,return,sub,dependency,FastAPI,嵌套,Depends,str,query 来源: https://www.cnblogs.com/learn-record/p/14825487.html