- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 522 for Depends (0.14 sec)
-
tests/test_dependency_overrides.py
@app.get("/decorator-depends/", dependencies=[Depends(common_parameters)]) async def decorator_depends(): return {"in": "decorator-depends"} @router.get("/router-depends/") async def router_depends(commons: dict = Depends(common_parameters)): return {"in": "router-depends", "params": commons} @router.get("/router-decorator-depends/", dependencies=[Depends(common_parameters)]) async def router_decorator_depends():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 15.4K bytes - Viewed (0) -
docs/em/docs/tutorial/dependencies/classes-as-dependencies.md
//// **FastAPI** 🤙 `CommonQueryParams` 🎓. 👉 ✍ "👐" 👈 🎓 & 👐 🔜 🚶♀️ 🔢 `commons` 👆 🔢. ## 🆎 ✍ 🆚 `Depends` 👀 ❔ 👥 ✍ `CommonQueryParams` 🕐 🔛 📟: ```Python commons: CommonQueryParams = Depends(CommonQueryParams) ``` 🏁 `CommonQueryParams`,: ```Python ... = Depends(CommonQueryParams) ``` ...⚫️❔ **FastAPI** 🔜 🤙 ⚙️ 💭 ⚫️❔ 🔗.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 5.9K bytes - Viewed (0) -
docs_src/sql_databases/tutorial002.py
@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate, session: Session = Depends(get_session)): db_hero = Hero.model_validate(hero) session.add(db_hero) session.commit() session.refresh(db_hero) return db_hero @app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes( session: Session = Depends(get_session), offset: int = 0, limit: int = Query(default=100, le=100), ):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 2.6K bytes - Viewed (0) -
tests/test_dependency_contextmanager.py
@app.get("/async") async def get_async(state: str = Depends(asyncgen_state)): return state @app.get("/sync") async def get_sync(state: str = Depends(generator_state)): return state @app.get("/async_raise") async def get_async_raise(state: str = Depends(asyncgen_state_try)): assert state == "asyncgen raise started" raise AsyncDependencyError()
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Aug 17 04:13:50 UTC 2024 - 11.6K bytes - Viewed (0) -
docs/ru/docs/tutorial/dependencies/classes-as-dependencies.md
```Python commons: Annotated[CommonQueryParams, Depends()] ``` //// //// tab | Python 3.6 без Annotated /// tip | "Подсказка" Рекомендуется использовать версию с `Annotated` если возможно. /// ```Python commons: CommonQueryParams = Depends() ``` ////
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 16K bytes - Viewed (0) -
docs_src/security/tutorial003_an_py310.py
return user async def get_current_active_user( current_user: Annotated[User, Depends(get_current_user)], ): if current_user.disabled: raise HTTPException(status_code=400, detail="Inactive user") return current_user @app.post("/token") async def login(form_data: Annotated[OAuth2PasswordRequestForm, Depends()]): user_dict = fake_users_db.get(form_data.username) if not user_dict:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Mar 26 16:56:53 UTC 2024 - 2.5K bytes - Viewed (0) -
docs_src/sql_databases/tutorial002_py39.py
@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate, session: Session = Depends(get_session)): db_hero = Hero.model_validate(hero) session.add(db_hero) session.commit() session.refresh(db_hero) return db_hero @app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes( session: Session = Depends(get_session), offset: int = 0, limit: int = Query(default=100, le=100), ):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 2.6K bytes - Viewed (0) -
docs_src/security/tutorial004_an.py
async def get_current_active_user( current_user: Annotated[User, Depends(get_current_user)], ): if current_user.disabled: raise HTTPException(status_code=400, detail="Inactive user") return current_user @app.post("/token") async def login_for_access_token( form_data: Annotated[OAuth2PasswordRequestForm, Depends()], ) -> Token:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 4.2K bytes - Viewed (0) -
docs_src/sql_databases/tutorial001_py39.py
def on_startup(): create_db_and_tables() @app.post("/heroes/") def create_hero(hero: Hero, session: Session = Depends(get_session)) -> Hero: session.add(hero) session.commit() session.refresh(hero) return hero @app.get("/heroes/") def read_heroes( session: Session = Depends(get_session), offset: int = 0, limit: int = Query(default=100, le=100), ) -> list[Hero]:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 1.8K bytes - Viewed (0) -
docs/zh/docs/tutorial/dependencies/classes-as-dependencies.md
``` //// **FastAPI** 调用 `CommonQueryParams` 类。这将创建该类的一个 "实例",该实例将作为参数 `commons` 被传递给你的函数。 ## 类型注解 vs `Depends` 注意,我们在上面的代码中编写了两次`CommonQueryParams`: ```Python commons: CommonQueryParams = Depends(CommonQueryParams) ``` 最后的 `CommonQueryParams`: ```Python ... = Depends(CommonQueryParams) ``` ...实际上是 **Fastapi** 用来知道依赖项是什么的。 FastAPI 将从依赖项中提取声明的参数,这才是 FastAPI 实际调用的。
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 6.4K bytes - Viewed (0)