Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 913 for annotated (0.24 sec)

  1. docs_src/security/tutorial003_an.py

            )
        return user
    
    
    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(form_data: Annotated[OAuth2PasswordRequestForm, Depends()]):
        user_dict = fake_users_db.get(form_data.username)
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  2. docs_src/security/tutorial003_an_py39.py

            )
        return user
    
    
    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(form_data: Annotated[OAuth2PasswordRequestForm, Depends()]):
        user_dict = fake_users_db.get(form_data.username)
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  3. fastapi/datastructures.py

        ```
        """
    
        file: Annotated[
            BinaryIO,
            Doc("The standard Python file object (non-async)."),
        ]
        filename: Annotated[Optional[str], Doc("The original file name.")]
        size: Annotated[Optional[int], Doc("The size of the file in bytes.")]
        headers: Annotated[Headers, Doc("The headers of the request.")]
        content_type: Annotated[
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Apr 02 02:48:51 UTC 2024
    - 5.6K bytes
    - Viewed (0)
  4. docs_src/dependencies/tutorial005_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import Cookie, Depends, FastAPI
    
    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/")
    async def read_query(
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 529 bytes
    - Viewed (0)
  5. docs/ru/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md

        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="18"
        {!> ../../../docs_src/dependencies/tutorial006_an.py!}
        ```
    
    === "Python 3.8 без Annotated"
    
        !!! Подсказка
            Рекомендуется использовать версию с Annotated, если возможно.
    
        ```Python hl_lines="17"
        {!> ../../../docs_src/dependencies/tutorial006.py!}
        ```
    
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Apr 06 15:43:55 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  6. docs_src/dependencies/tutorial008_an.py

    from typing_extensions import Annotated
    
    
    async def dependency_a():
        dep_a = generate_dep_a()
        try:
            yield dep_a
        finally:
            dep_a.close()
    
    
    async def dependency_b(dep_a: Annotated[DepA, Depends(dependency_a)]):
        dep_b = generate_dep_b()
        try:
            yield dep_b
        finally:
            dep_b.close(dep_a)
    
    
    async def dependency_c(dep_b: Annotated[DepB, Depends(dependency_b)]):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 531 bytes
    - Viewed (0)
  7. docs_src/request_files/tutorial001_03_an.py

    from fastapi import FastAPI, File, UploadFile
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.post("/files/")
    async def create_file(file: Annotated[bytes, File(description="A file read as bytes")]):
        return {"file_size": len(file)}
    
    
    @app.post("/uploadfile/")
    async def create_upload_file(
        file: Annotated[UploadFile, File(description="A file read as UploadFile")],
    ):
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 431 bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/request-files.md

        ```
    
    === "Python 3.10+ non-Annotated"
    
        !!! tip
            Prefer to use the `Annotated` version if possible.
    
        ```Python hl_lines="7  15"
        {!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
        ```
    
    === "Python 3.8+ non-Annotated"
    
        !!! tip
            Prefer to use the `Annotated` version if possible.
    
        ```Python hl_lines="9  17"
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Wed Mar 13 19:02:19 UTC 2024
    - 10.2K bytes
    - Viewed (0)
  9. docs_src/dependencies/tutorial001_an_py39.py

    from typing import Annotated, Union
    
    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: Annotated[dict, Depends(common_parameters)]):
        return commons
    
    
    @app.get("/users/")
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 473 bytes
    - Viewed (0)
  10. docs_src/path_params_numeric_validations/tutorial001_an.py

    from typing import Union
    
    from fastapi import FastAPI, Path, Query
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(
        item_id: Annotated[int, Path(title="The ID of the item to get")],
        q: Annotated[Union[str, None], Query(alias="item-query")] = None,
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Registered: Mon Jun 17 08:32:26 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 417 bytes
    - Viewed (0)
Back to top