- Sort Score
- Result 10 results
- Languages All
Results 81 - 90 of 410 for depende (0.08 sec)
-
docs_src/dependencies/tutorial008_an.py
from fastapi import Depends from typing_extensions import Annotated async def dependency_a(): dep_a = generate_dep_a() try: yield dep_a finally: dep_a.close() async def dependency_b(dep_a: Annotated[DepA, Depends(dependency_a)]): dep_b = generate_dep_b() try: yield dep_b finally: dep_b.close(dep_a)
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 531 bytes - Viewed (0) -
docs_src/bigger_applications/app/main.py
from fastapi import Depends, FastAPI from .dependencies import get_query_token, get_token_header from .internal import admin from .routers import items, users app = FastAPI(dependencies=[Depends(get_query_token)]) app.include_router(users.router) app.include_router(items.router) app.include_router( admin.router, prefix="/admin", tags=["admin"], dependencies=[Depends(get_token_header)],
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sun Nov 29 17:32:18 UTC 2020 - 552 bytes - Viewed (0) -
docs_src/dependencies/tutorial001.py
from fastapi import Depends, FastAPI app = FastAPI() async def common_parameters( q: Union[str, None] = None, skip: int = 0, limit: int = 100 ): return {"q": q, "skip": skip, "limit": limit} @app.get("/items/") async def read_items(commons: dict = Depends(common_parameters)): return commons @app.get("/users/") async def read_users(commons: dict = Depends(common_parameters)):
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 442 bytes - Viewed (0) -
docs_src/dependencies/tutorial001_an_py39.py
from typing import Annotated, Union from fastapi import Depends, FastAPI app = FastAPI() async def common_parameters( q: Union[str, None] = None, skip: int = 0, limit: int = 100 ): return {"q": q, "skip": skip, "limit": limit} @app.get("/items/") async def read_items(commons: Annotated[dict, Depends(common_parameters)]): return commons @app.get("/users/")
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 473 bytes - Viewed (0) -
docs_src/dependencies/tutorial008d_an_py39.py
from fastapi import Depends, FastAPI, HTTPException app = FastAPI() class InternalError(Exception): pass def get_username(): try: yield "Rick" except InternalError: print("We don't swallow the internal error here, we raise again π") raise @app.get("/items/{item_id}") def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sat Feb 24 23:06:37 UTC 2024 - 734 bytes - Viewed (0) -
docs_src/dependencies/tutorial006.py
@app.get("/items/", dependencies=[Depends(verify_token), Depends(verify_key)]) async def read_items():
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 583 bytes - Viewed (0) -
docs_src/dependencies/tutorial005_py310.py
from fastapi import Cookie, Depends, FastAPI app = FastAPI() def query_extractor(q: str | None = None): return q def query_or_cookie_extractor( q: str = Depends(query_extractor), last_query: str | None = Cookie(default=None) ): if not q: return last_query return q @app.get("/items/") async def read_query(query_or_default: str = Depends(query_or_cookie_extractor)):
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 443 bytes - Viewed (0) -
docs/ko/docs/tutorial/dependencies/index.md
{!> ../../docs_src/dependencies/tutorial001.py!} ``` //// λΉλ‘ `Body`, `Query` λ±μ μ¬μ©νλ κ²κ³Ό κ°μ λ°©μμΌλ‘ μ¬λ¬λΆμ ν¨μμ 맀κ°λ³μμ μλ `Depends`λ₯Ό μ¬μ©νμ§λ§, `Depends`λ μ½κ° λ€λ₯΄κ² μλν©λλ€. `Depends`μ λ¨μΌ 맀κ°λ³μλ§ μ λ¬νμ΅λλ€. μ΄ λ§€κ°λ³μλ ν¨μκ°μ κ²μ΄μ΄μΌ ν©λλ€. μ¬λ¬λΆμ μ§μ **νΈμΆνμ§ μμμ΅λλ€** (λμ κ΄νΈλ₯Ό μΉμ§ μμμ΅λλ€), λ¨μ§ `Depends()`μ 맀κ°λ³μλ‘ λ겨 쀬μ λΏμ λλ€. κ·Έλ¦¬κ³ κ·Έ ν¨μλ *κ²½λ‘ μλ ν¨μ*κ° μλνλ κ²κ³Ό κ°μ λ°©μμΌλ‘ 맀κ°λ³μλ₯Ό λ°μ΅λλ€. /// tip | "ν"
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 13.5K bytes - Viewed (0) -
docs_src/dependencies/tutorial005.py
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_query: Union[str, None] = Cookie(default=None), ): if not q: return last_query return q @app.get("/items/") async def read_query(query_or_default: str = Depends(query_or_cookie_extractor)):
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 486 bytes - Viewed (0) -
docs_src/dependencies/tutorial005_an_py310.py
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)], last_query: Annotated[str | None, Cookie()] = None, ): if not q: return last_query return q @app.get("/items/") async def read_query(
Registered: Sun Oct 27 07:19:11 UTC 2024 - Last Modified: Tue Mar 26 16:56:53 UTC 2024 - 510 bytes - Viewed (0)