- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 309 for Depends (0.08 sec)
-
docs_src/sql_databases_peewee/sql_app/main.py
def get_db(db_state=Depends(reset_db_state)): try: database.db.connect() yield finally: if not database.db.is_closed(): database.db.close() @app.post("/users/", response_model=schemas.User, dependencies=[Depends(get_db)]) def create_user(user: schemas.UserCreate): db_user = crud.get_user_by_email(email=user.email) if db_user:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 2.2K 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) -
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) -
docs_src/security/tutorial004.py
return user async def get_current_active_user(current_user: 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: OAuth2PasswordRequestForm = Depends(), ) -> Token:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 4.1K bytes - Viewed (0) -
docs_src/security/tutorial004_an_py310.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.1K bytes - Viewed (0)