Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 226 for Depends (0.1 sec)

  1. 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)
  2. 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)
  3. 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)
  4. fastapi/dependencies/utils.py

    
    def get_parameterless_sub_dependant(*, depends: params.Depends, path: str) -> Dependant:
        assert callable(
            depends.dependency
        ), "A parameter-less dependency must have a callable dependency"
        return get_sub_dependant(depends=depends, dependency=depends.dependency, path=path)
    
    
    def get_sub_dependant(
        *,
        depends: params.Depends,
        dependency: Callable[..., Any],
        path: str,
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 21:46:26 UTC 2024
    - 34.7K bytes
    - Viewed (0)
  5. docs/pt/docs/tutorial/dependencies/index.md

    ```
    
    ////
    
    Ainda que `Depends` seja utilizado nos parâmetros da função da mesma forma que `Body`, `Query`, etc, `Depends` funciona de uma forma um pouco diferente.
    
    Você fornece um único parâmetro para `Depends`.
    
    Esse parâmetro deve ser algo como uma função.
    
    Você **não chama a função** diretamente (não adicione os parênteses no final), apenas a passe como parâmetro de `Depends()`.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 12.6K bytes
    - Viewed (0)
  6. docs/de/docs/tutorial/dependencies/classes-as-dependencies.md

    ```Python
    commons: Annotated[CommonQueryParams, Depends()]
    ```
    
    ////
    
    //// tab | Python 3.8 nicht annotiert
    
    /// tip | "Tipp"
    
    Bevorzugen Sie die `Annotated`-Version, falls möglich.
    
    ///
    
    ```Python
    commons: CommonQueryParams = Depends()
    ```
    
    ////
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 12K bytes
    - Viewed (0)
  7. docs/pt/docs/tutorial/dependencies/classes-as-dependencies.md

    ```
    
    ////
    
    //// tab | Python 3.8 non-Annotated
    
    /// tip | "Dica"
    
    Utilize a versão com `Annotated` se possível.
    
    ///
    
    ```Python
    commons: CommonQueryParams = Depends()
    ```
    
    ////
    
    Você declara a dependência como o tipo do parâmetro, e utiliza `Depends()` sem nenhum parâmetro, em vez de ter que escrever a classe *novamente* dentro de `Depends(CommonQueryParams)`.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 11.6K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/dependencies/classes-as-dependencies.md

    ```
    
    ////
    
    //// tab | Python 3.8 non-Annotated
    
    /// tip
    
    Prefer to use the `Annotated` version if possible.
    
    ///
    
    ```Python
    commons: CommonQueryParams = Depends()
    ```
    
    ////
    
    You declare the dependency as the type of the parameter, and you use `Depends()` without any parameter, instead of having to write the full class *again* inside of `Depends(CommonQueryParams)`.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 11.1K bytes
    - Viewed (0)
  9. docs/de/docs/tutorial/dependencies/index.md

    ```
    
    ////
    
    Obwohl Sie `Depends` in den Parametern Ihrer Funktion genauso verwenden wie `Body`, `Query`, usw., funktioniert `Depends` etwas anders.
    
    Sie übergeben `Depends` nur einen einzigen Parameter.
    
    Dieser Parameter muss so etwas wie eine Funktion sein.
    
    Sie **rufen diese nicht direkt auf** (fügen Sie am Ende keine Klammern hinzu), sondern übergeben sie einfach als Parameter an `Depends()`.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 13K bytes
    - Viewed (0)
  10. fastapi/security/http.py

        ```python
        from typing import Annotated
    
        from fastapi import Depends, FastAPI
        from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
        app = FastAPI()
    
        security = HTTPBasic()
    
    
        @app.get("/users/me")
        def read_current_user(credentials: Annotated[HTTPBasicCredentials, Depends(security)]):
            return {"username": credentials.username, "password": credentials.password}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Sep 19 09:47:28 UTC 2024
    - 13.2K bytes
    - Viewed (0)
Back to top