Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 418 for Annotated (0.04 seconds)

  1. tests/test_ambiguous_params.py

        @app.get("/multi-query")
        async def get(foo: Annotated[int, Query(gt=2), Query(lt=10)]):
            return foo
    
        with pytest.raises(
            AssertionError,
            match=(
                "Cannot specify `Depends` in `Annotated` and default value"
                " together for 'foo'"
            ),
        ):
    
            @app.get("/")
            async def get2(foo: Annotated[int, Depends(dep)] = Depends(dep)):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 2K bytes
    - Click Count (1)
  2. fastapi/security/http.py

        dependency.
    
        Read more about it in the
        [FastAPI docs for HTTP Basic Auth](https://fastapi.tiangolo.com/advanced/security/http-basic-auth/).
        """
    
        username: Annotated[str, Doc("The HTTP Basic username.")]
        password: Annotated[str, Doc("The HTTP Basic password.")]
    
    
    class HTTPAuthorizationCredentials(BaseModel):
        """
        The HTTP authorization credentials in the result of using `HTTPBearer` or
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Mar 16 10:16:48 GMT 2026
    - 13.1K bytes
    - Click Count (0)
  3. docs/en/docs/tutorial/dependencies/classes-as-dependencies.md

    Notice how we write `CommonQueryParams` twice in the above code:
    
    //// tab | Python 3.10+
    
    ```Python
    commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
    ```
    
    ////
    
    //// tab | Python 3.10+ non-Annotated
    
    /// tip
    
    Prefer to use the `Annotated` version if possible.
    
    ///
    
    ```Python
    commons: CommonQueryParams = Depends(CommonQueryParams)
    ```
    
    ////
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 11 18:32:12 GMT 2026
    - 6.8K bytes
    - Click Count (0)
  4. docs/zh-hant/docs/tutorial/dependencies/classes-as-dependencies.md

    注意上面程式碼裡我們寫了兩次 `CommonQueryParams`:
    
    //// tab | Python 3.10+
    
    ```Python
    commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
    ```
    
    ////
    
    //// tab | Python 3.10+ 非 Annotated
    
    /// tip
    
    如有可能,優先使用 `Annotated` 版本。
    
    ///
    
    ```Python
    commons: CommonQueryParams = Depends(CommonQueryParams)
    ```
    
    ////
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Feb 14 08:15:26 GMT 2026
    - 6.7K bytes
    - Click Count (0)
  5. fastapi/sse.py

        ] = None,
        id: Annotated[
            str | None,
            Doc(
                """
                Optional event ID (`id:` field).
                """
            ),
        ] = None,
        retry: Annotated[
            int | None,
            Doc(
                """
                Optional reconnection time in milliseconds (`retry:` field).
                """
            ),
        ] = None,
        comment: Annotated[
            str | None,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 09:21:52 GMT 2026
    - 6.2K bytes
    - Click Count (0)
  6. tests/test_response_dependency.py

    and that the dependency injection system properly handles them.
    """
    
    from typing import Annotated
    
    from fastapi import BackgroundTasks, Depends, FastAPI, Request, Response
    from fastapi.responses import JSONResponse
    from fastapi.testclient import TestClient
    
    
    def test_response_with_depends_annotated():
        """Response type hint should work with Annotated[Response, Depends(...)]."""
        app = FastAPI()
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 05 18:23:16 GMT 2026
    - 5.2K bytes
    - Click Count (0)
  7. docs/ko/docs/tutorial/query-params-str-validations.md

    ### `Query`와 `Annotated` 임포트 { #import-query-and-annotated }
    
    이를 위해 먼저 다음을 임포트합니다:
    
    * `fastapi`에서 `Query`
    * `typing`에서 `Annotated`
    
    {* ../../docs_src/query_params_str_validations/tutorial002_an_py310.py hl[1,3] *}
    
    /// info | 정보
    
    FastAPI는 0.95.0 버전에서 `Annotated` 지원을 추가했고(그리고 이를 권장하기 시작했습니다).
    
    이전 버전을 사용하면 `Annotated`를 사용하려고 할 때 오류가 발생합니다.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:06:26 GMT 2026
    - 18.7K bytes
    - Click Count (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(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 510 bytes
    - Click Count (0)
  9. docs/zh-hant/docs/tutorial/path-params-numeric-validations.md

    ## 匯入 `Path` { #import-path }
    
    首先,從 `fastapi` 匯入 `Path`,並匯入 `Annotated`:
    
    {* ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py hl[1,3] *}
    
    /// info
    
    FastAPI 在 0.95.0 版加入並開始推薦使用 `Annotated`。
    
    如果你使用更舊的版本,嘗試使用 `Annotated` 會出錯。
    
    請確保在使用 `Annotated` 前,先[升級 FastAPI 版本](../deployment/versions.md#upgrading-the-fastapi-versions)到至少 0.95.1。
    
    ///
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 5.8K bytes
    - Click Count (0)
  10. fastapi/param_functions.py

        ] = None,
        min_length: Annotated[
            int | None,
            Doc(
                """
                Minimum length for strings.
                """
            ),
        ] = None,
        max_length: Annotated[
            int | None,
            Doc(
                """
                Maximum length for strings.
                """
            ),
        ] = None,
        pattern: Annotated[
            str | None,
            Doc(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 68K bytes
    - Click Count (0)
Back to Top