Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 1,008 for prepends (0.26 sec)

  1. 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: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Mon May 20 17:37:28 UTC 2024
    - 4.2K bytes
    - Viewed (0)
  2. guava-tests/test/com/google/common/base/EnumsTest.java

      // Run Enums.getIfPresent on that other TestEnum and then return a WeakReference containing the
      // new ClassLoader. If Enums.getIfPresent does caching that prevents the shadow TestEnum
      // (and therefore its ClassLoader) from being unloaded, then this WeakReference will never be
      // cleared.
      @J2ktIncompatible
      @GwtIncompatible // weak references
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed May 29 16:29:37 UTC 2024
    - 8.7K bytes
    - Viewed (0)
  3. docs_src/security/tutorial007_an_py39.py

    import secrets
    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
    app = FastAPI()
    
    security = HTTPBasic()
    
    
    def get_current_username(
        credentials: Annotated[HTTPBasicCredentials, Depends(security)],
    ):
        current_username_bytes = credentials.username.encode("utf8")
        correct_username_bytes = b"stanleyjobson"
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  4. 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/")
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 558 bytes
    - Viewed (0)
  5. 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: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Oct 17 05:59:11 UTC 2023
    - 6.5K bytes
    - Viewed (0)
  6. docs/ru/docs/tutorial/dependencies/classes-as-dependencies.md

        ```
    
    === "Python 3.6 без Annotated"
    
        !!! tip "Подсказка"
            Рекомендуется использовать версию с `Annotated` если возможно.
    
        ```Python
        commons: CommonQueryParams = Depends()
        ```
    
    Вы объявляете зависимость как тип параметра и используете `Depends()` без какого-либо параметра, вместо того чтобы *снова* писать полный класс внутри `Depends(CommonQueryParams)`.
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Fri Jan 12 11:12:19 UTC 2024
    - 16.3K bytes
    - Viewed (0)
  7. platforms/documentation/docs/src/snippets/antMigration/multiProject/groovy/web/build.xml

        </target>
        <!-- end::build-required[] -->
    
        <target name="compile" depends="buildRequiredProjects">
            <mkdir dir="${classes.dir}"/>
            <javac srcdir="${src.dir}" destdir="${classes.dir}" classpath="${root.dir}/util/${classes.dir}" debug="true"/>
        </target>
    
        <target name="package" depends="build">
            <jar destfile="${build.dir}/lib/hello-app.jar" basedir="${classes.dir}"/>
        </target>
    
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Mon Nov 27 17:53:42 UTC 2023
    - 922 bytes
    - Viewed (0)
  8. 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)
  9. 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)
  10. 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)
Back to top