Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 401 for dependsOn (0.43 sec)

  1. docs_src/dependencies/tutorial006_an.py

        return x_key
    
    
    @app.get("/items/", dependencies=[Depends(verify_token), Depends(verify_key)])
    async def read_items():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 643 bytes
    - Viewed (0)
  2. docs_src/dependency_testing/tutorial001_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import Depends, FastAPI
    from fastapi.testclient import TestClient
    
    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 {"message": "Hello Items!", "params": commons}
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.5K bytes
    - Viewed (0)
  3. docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md

    **FastAPI**는 `CommonQueryParams` 클래스를 호출합니다. 이것은 해당 클래스의 "인스턴스"를 생성하고 그 인스턴스는 함수의 매개변수 `commons`로 전달됩니다.
    
    ## 타입 힌팅 vs `Depends`
    
    위 코드에서 `CommonQueryParams`를 두 번 작성한 방식에 주목하십시오:
    
    ```Python
    commons: CommonQueryParams = Depends(CommonQueryParams)
    ```
    
    마지막 `CommonQueryParams` 변수를 보면:
    
    ```Python
    ... = Depends(CommonQueryParams)
    ```
    
    ... **FastAPI**가 실제로 어떤 것이 의존성인지 알기 위해서 사용하는 방법입니다.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Feb 11 13:48:31 GMT 2024
    - 8K bytes
    - Viewed (0)
  4. tests/test_dependency_duplicates.py

    ):
        return [item, sub_item]
    
    
    @app.post("/with-duplicates")
    async def with_duplicates(item: Item, item2: Item = Depends(duplicate_dependency)):
        return [item, item2]
    
    
    @app.post("/no-duplicates")
    async def no_duplicates(item: Item, item2: Item = Depends(dependency)):
        return [item, item2]
    
    
    @app.post("/with-duplicates-sub")
    async def no_duplicates_sub(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  5. docs/ru/docs/tutorial/dependencies/classes-as-dependencies.md

        ```
    
    === "Python 3.6 без Annotated"
    
        !!! tip "Подсказка"
            Рекомендуется использовать версию с `Annotated` если возможно.
    
        ```Python
        commons: CommonQueryParams = Depends()
        ```
    
    Вы объявляете зависимость как тип параметра и используете `Depends()` без какого-либо параметра, вместо того чтобы *снова* писать полный класс внутри `Depends(CommonQueryParams)`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 12 11:12:19 GMT 2024
    - 16.3K bytes
    - Viewed (0)
  6. docs_src/dependencies/tutorial001_an.py

    from typing import Union
    
    from fastapi import Depends, FastAPI
    from typing_extensions import Annotated
    
    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/")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 502 bytes
    - Viewed (0)
  7. docs_src/security/tutorial003_an_py39.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:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 2.5K bytes
    - Viewed (0)
  8. 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(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 510 bytes
    - Viewed (0)
  9. docs_src/bigger_applications/app_an_py39/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)],
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 552 bytes
    - Viewed (0)
  10. docs_src/security/tutorial003_py310.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(form_data: OAuth2PasswordRequestForm = Depends()):
        user_dict = fake_users_db.get(form_data.username)
        if not user_dict:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 2.4K bytes
    - Viewed (0)
Back to top