Search Options

Results per page
Sort
Preferred Languages
Advance

Results 161 - 170 of 782 for asyncio (0.03 sec)

  1. docs_src/body_updates/tutorial001_py310.py

        "baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []},
    }
    
    
    @app.get("/items/{item_id}", response_model=Item)
    async def read_item(item_id: str):
        return items[item_id]
    
    
    @app.put("/items/{item_id}", response_model=Item)
    async def update_item(item_id: str, item: Item):
        update_item_encoded = jsonable_encoder(item)
        items[item_id] = update_item_encoded
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 856 bytes
    - Viewed (0)
  2. docs/ru/docs/advanced/dataclasses.md

    8. Обратите внимание, что эта *функция-обработчик пути* использует обычный `def` вместо `async def`.
    
        Как и всегда в FastAPI, вы можете сочетать `def` и `async def` по необходимости.
    
        Если хотите освежить в памяти, когда что использовать, посмотрите раздел _"Нет времени?"_ в документации про [`async` и `await`](../async.md#in-a-hurry){.internal-link target=_blank}.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 6.6K bytes
    - Viewed (0)
  3. docs_src/custom_request_and_route/tutorial002_an_py39.py

    from fastapi.routing import APIRoute
    
    
    class ValidationErrorLoggingRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                try:
                    return await original_route_handler(request)
                except RequestValidationError as exc:
                    body = await request.body()
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 10 08:55:32 UTC 2025
    - 947 bytes
    - Viewed (0)
  4. docs_src/custom_request_and_route/tutorial002_py310.py

    from fastapi.routing import APIRoute
    
    
    class ValidationErrorLoggingRoute(APIRoute):
        def get_route_handler(self) -> Callable:
            original_route_handler = super().get_route_handler()
    
            async def custom_route_handler(request: Request) -> Response:
                try:
                    return await original_route_handler(request)
                except RequestValidationError as exc:
                    body = await request.body()
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 10 08:55:32 UTC 2025
    - 935 bytes
    - Viewed (0)
  5. docs_src/response_model/tutorial006_py39.py

    }
    
    
    @app.get(
        "/items/{item_id}/name",
        response_model=Item,
        response_model_include=["name", "description"],
    )
    async def read_item_name(item_id: str):
        return items[item_id]
    
    
    @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude=["tax"])
    async def read_item_public_data(item_id: str):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 848 bytes
    - Viewed (0)
  6. docs_src/custom_docs_ui/tutorial002_py39.py

            swagger_css_url="/static/swagger-ui.css",
        )
    
    
    @app.get(app.swagger_ui_oauth2_redirect_url, include_in_schema=False)
    async def swagger_ui_redirect():
        return get_swagger_ui_oauth2_redirect_html()
    
    
    @app.get("/redoc", include_in_schema=False)
    async def redoc_html():
        return get_redoc_html(
            openapi_url=app.openapi_url,
            title=app.title + " - ReDoc",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.1K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/request-files.md

        * This is especially useful if you run `await myfile.read()` once and then need to read the contents again.
    * `close()`: Closes the file.
    
    As all these methods are `async` methods, you need to "await" them.
    
    For example, inside of an `async` *path operation function* you can get the contents with:
    
    ```Python
    contents = await myfile.read()
    ```
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sun Aug 31 09:15:41 UTC 2025
    - 7.3K bytes
    - Viewed (0)
  8. docs/ru/docs/tutorial/request-files.md

    * `close()`: Закрыть файл.
    
    Поскольку все эти методы являются `async` методами, вам следует использовать "await" вместе с ними.
    
    Например, внутри `async` *функции операции пути* можно получить содержимое с помощью:
    
    ```Python
    contents = await myfile.read()
    ```
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Sep 30 11:24:39 UTC 2025
    - 11.7K bytes
    - Viewed (0)
  9. fastapi/security/api_key.py

        ```python
        from fastapi import Depends, FastAPI
        from fastapi.security import APIKeyQuery
    
        app = FastAPI()
    
        query_scheme = APIKeyQuery(name="api_key")
    
    
        @app.get("/items/")
        async def read_items(api_key: str = Depends(query_scheme)):
            return {"api_key": api_key}
        ```
        """
    
        def __init__(
            self,
            *,
            name: Annotated[
                str,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 9.6K bytes
    - Viewed (1)
  10. docs/ru/docs/advanced/events.md

    ```Python
    with open("file.txt") as file:
        file.read()
    ```
    
    В последних версиях Python есть также асинхронный менеджер контекста. Его используют с `async with`:
    
    ```Python
    async with lifespan(app):
        await do_stuff()
    ```
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 12.7K bytes
    - Viewed (0)
Back to top