Results of 1 - 1 of about 1 for extractor (0.001 sec.)
- サブ依存関係 9414
- サブ依存関係 サブ依存関係 を持つ依存関係を作成することができます。 それらは必要なだけ 深く することができます。 FastAPI はそれらを解決してくれます。 最初の依存関係「依存可能なもの」 以下のような最初の依存関係(「依存可能なもの」)を作成する
...on 3.8+ - non-Annotated from typing import Union from fastapi import Cookie , Depends , FastAPI app = FastAPI () def query_extractor ( q : Union [ str , None ] = None ): return q def query_or_cookie_extractor ( q : str = Depends ( query_extractor ), last_...urn last_query return q @app . get ( "/items/" ) async def read_query ( query_or_default : str = Depends ( query_or_cookie_extractor )): return { "q_or_cookie" : query_or_default } ? Other versions and variants Python 3.10+ Python 3.9+ Python 3.8+ Python...10+ - non-Annotated from typing import Annotated from fastapi import Cookie , Depends , FastAPI app = FastAPI () def query_extractor ( q : str | None = None ): return q def query_or_cookie_extractor ( q : Annotated [ str , Depends ( query_extractor )], la... - https://man.mtool.work/fastapi/0.115/tutorial/dependencies/sub-dependencies/
PREV
1
NEXT