Search Options

Results per page
Sort
Preferred Languages
Advance

Results 71 - 80 of 1,421 for prepends (0.32 sec)

  1. tests/test_repeated_cookie_headers.py

    from fastapi import Depends, FastAPI, Response
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    def set_cookie(*, response: Response):
        response.set_cookie("cookie-name", "cookie-value")
        return {}
    
    
    def set_indirect_cookie(*, dep: str = Depends(set_cookie)):
        return dep
    
    
    @app.get("/directCookie")
    def get_direct_cookie(dep: str = Depends(set_cookie)):
        return {"dep": dep}
    
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Jun 13 12:44:51 UTC 2020
    - 792 bytes
    - Viewed (0)
  2. 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)`.
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Thu Apr 18 19:53:19 UTC 2024
    - 11.4K bytes
    - Viewed (0)
  3. docs_src/security/tutorial002_an_py39.py

        )
    
    
    async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
        user = fake_decode_token(token)
        return user
    
    
    @app.get("/users/me")
    async def read_users_me(current_user: Annotated[User, Depends(get_current_user)]):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 786 bytes
    - Viewed (0)
  4. docs_src/security/tutorial007.py

    import secrets
    
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
    app = FastAPI()
    
    security = HTTPBasic()
    
    
    def get_current_username(credentials: HTTPBasicCredentials = Depends(security)):
        current_username_bytes = credentials.username.encode("utf8")
        correct_username_bytes = b"stanleyjobson"
        is_correct_username = secrets.compare_digest(
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Thu Jan 11 14:33:05 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  5. docs_src/dependencies/tutorial005_py310.py

    from fastapi import Cookie, Depends, FastAPI
    
    app = FastAPI()
    
    
    def query_extractor(q: str | None = None):
        return q
    
    
    def query_or_cookie_extractor(
        q: str = Depends(query_extractor), last_query: str | None = Cookie(default=None)
    ):
        if not q:
            return last_query
        return q
    
    
    @app.get("/items/")
    async def read_query(query_or_default: str = Depends(query_or_cookie_extractor)):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 443 bytes
    - Viewed (0)
  6. 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:
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Mon May 20 17:37:28 UTC 2024
    - 4K bytes
    - Viewed (0)
  7. docs_src/dependencies/tutorial005.py

    from fastapi import Cookie, Depends, FastAPI
    
    app = FastAPI()
    
    
    def query_extractor(q: Union[str, None] = None):
        return q
    
    
    def query_or_cookie_extractor(
        q: str = Depends(query_extractor),
        last_query: Union[str, None] = Cookie(default=None),
    ):
        if not q:
            return last_query
        return q
    
    
    @app.get("/items/")
    async def read_query(query_or_default: str = Depends(query_or_cookie_extractor)):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 486 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(
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 510 bytes
    - Viewed (0)
  9. src/cmd/go/testdata/mod/example.com_depends_on_generics_v1.0.0.txt

    example.com/depends/on/generics v1.0.0
    written by hand
    
    -- .mod --
    module example.com/depends/on/generics
    
    go 1.18
    
    require example.com/generics v1.0.0
    -- .info --
    {"Version":"v1.0.0"}
    -- go.mod --
    module example.com/depends/on/generics
    
    go 1.18
    
    require example.com/generics v1.0.0
    -- main.go --
    package main
    
    import "example.com/generics"
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 11 20:37:36 UTC 2022
    - 370 bytes
    - Viewed (0)
  10. platforms/documentation/docs/src/docs/userguide/core-plugins/idea_plugin.adoc

    [[ideatasks]]
    `idea`::
    _Depends on_: `ideaProject`, `ideaModule`, `ideaWorkspace`
    +
    Generates all IDEA configuration files
    
    `openIdea`::
    _Depends on_: `idea`
    +
    Generates all IDEA configuration files and opens the project in IDEA
    
    `cleanIdea` — link:{groovyDslPath}/org.gradle.api.tasks.Delete.html[Delete]::
    _Depends on_: `cleanIdeaProject`, `cleanIdeaModule`
    +
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Thu Dec 07 01:37:51 UTC 2023
    - 12.8K bytes
    - Viewed (0)
Back to top