Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 401 for dependsOn (0.16 sec)

  1. docs/en/docs/tutorial/dependencies/classes-as-dependencies.md

        ```
    
    === "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)`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.4K bytes
    - Viewed (0)
  2. fastapi/security/api_key.py

        ## Usage
    
        Create an instance object and use that object as the dependency in `Depends()`.
    
        The dependency result will be a string containing the key value.
    
        ## Example
    
        ```python
        from fastapi import Depends, FastAPI
        from fastapi.security import APIKeyQuery
    
        app = FastAPI()
    
        query_scheme = APIKeyQuery(name="api_key")
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 23 22:29:18 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  3. docs/en/docs/reference/dependencies.md

    # Dependencies - `Depends()` and `Security()`
    
    ## `Depends()`
    
    Dependencies are handled mainly with the special function `Depends()` that takes a callable.
    
    Here is the reference for it and its parameters.
    
    You can import it directly from `fastapi`:
    
    ```python
    from fastapi import Depends
    ```
    
    ::: fastapi.Depends
    
    ## `Security()`
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 671 bytes
    - Viewed (0)
  4. docs/de/docs/reference/dependencies.md

    # Abhängigkeiten – `Depends()` und `Security()`
    
    ## `Depends()`
    
    Abhängigkeiten werden hauptsächlich mit der speziellen Funktion `Depends()` behandelt, die ein Callable entgegennimmt.
    
    Hier finden Sie deren Referenz und Parameter.
    
    Sie können sie direkt von `fastapi` importieren:
    
    ```python
    from fastapi import Depends
    ```
    
    ::: fastapi.Depends
    
    ## `Security()`
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 18:16:45 GMT 2024
    - 765 bytes
    - Viewed (0)
  5. docs_src/security/tutorial004_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_for_access_token(
        form_data: OAuth2PasswordRequestForm = Depends(),
    ) -> Token:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4K bytes
    - Viewed (0)
  6. docs/em/docs/tutorial/dependencies/classes-as-dependencies.md

        ```
    
    **FastAPI** 🤙 `CommonQueryParams` 🎓. 👉 ✍ "👐" 👈 🎓 & 👐 🔜 🚶‍♀️ 🔢 `commons` 👆 🔢.
    
    ## 🆎 ✍ 🆚 `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: Sat Apr 01 09:26:04 GMT 2023
    - 6K bytes
    - Viewed (0)
  7. 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)):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 442 bytes
    - Viewed (0)
  8. 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()
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  9. tests/test_dependency_class.py

    @app.get("/callable-dependency")
    async def get_callable_dependency(value: str = Depends(callable_dependency)):
        return value
    
    
    @app.get("/callable-gen-dependency")
    async def get_callable_gen_dependency(value: str = Depends(callable_gen_dependency)):
        return value
    
    
    @app.get("/async-callable-dependency")
    async def get_async_callable_dependency(
        value: str = Depends(async_callable_dependency),
    ):
        return value
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Aug 09 10:54:05 GMT 2020
    - 3.3K bytes
    - Viewed (0)
  10. docs_src/dependencies/tutorial005_an.py

    from typing import Union
    
    from fastapi import Cookie, Depends, FastAPI
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    def query_extractor(q: Union[str, None] = None):
        return q
    
    
    def query_or_cookie_extractor(
        q: Annotated[str, Depends(query_extractor)],
        last_query: Annotated[Union[str, None], Cookie()] = None,
    ):
        if not q:
            return last_query
        return q
    
    
    @app.get("/items/")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 558 bytes
    - Viewed (0)
Back to top