Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 281 - 290 of 795 for asyncId (0.06 seconds)

  1. fastapi/background.py

            with open("log.txt", mode="w") as email_file:
                content = f"notification for {email}: {message}"
                email_file.write(content)
    
    
        @app.post("/send-notification/{email}")
        async def send_notification(email: str, background_tasks: BackgroundTasks):
            background_tasks.add_task(write_notification, email, message="some notification")
            return {"message": "Notification sent in the background"}
        ```
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 11 18:41:21 GMT 2026
    - 1.8K bytes
    - Click Count (0)
  2. docs/uk/docs/tutorial/dependencies/sub-dependencies.md

    //// tab | Python 3.10+
    
    ```Python hl_lines="1"
    async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]):
        return {"fresh_value": fresh_value}
    ```
    
    ////
    
    //// tab | Python 3.10+ без Annotated
    
    /// tip | Порада
    
    Надавайте перевагу версії з `Annotated`, якщо це можливо.
    
    ///
    
    ```Python hl_lines="1"
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Feb 14 08:43:14 GMT 2026
    - 5.7K bytes
    - Click Count (0)
  3. tests/test_request_params/test_query/test_list.py

    # Alias
    
    
    @app.get("/required-list-alias")
    async def read_required_list_alias(p: Annotated[list[str], Query(alias="p_alias")]):
        return {"p": p}
    
    
    class QueryModelRequiredListAlias(BaseModel):
        p: list[str] = Field(alias="p_alias")
    
    
    @app.get("/model-required-list-alias")
    async def read_model_required_list_alias(
        p: Annotated[QueryModelRequiredListAlias, Query()],
    ):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 11.2K bytes
    - Click Count (0)
  4. tests/test_request_params/test_cookie/test_required_str.py

    # Without aliases
    
    
    @app.get("/required-str")
    async def read_required_str(p: Annotated[str, Cookie()]):
        return {"p": p}
    
    
    class CookieModelRequiredStr(BaseModel):
        p: str
    
    
    @app.get("/model-required-str")
    async def read_model_required_str(p: Annotated[CookieModelRequiredStr, Cookie()]):
        return {"p": p.p}
    
    
    @pytest.mark.parametrize(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 10.4K bytes
    - Click Count (0)
  5. tests/test_request_params/test_file/test_required.py

    # Without aliases
    
    
    @app.post("/required-bytes", operation_id="required_bytes")
    async def read_required_bytes(p: Annotated[bytes, File()]):
        return {"file_size": len(p)}
    
    
    @app.post("/required-uploadfile", operation_id="required_uploadfile")
    async def read_required_uploadfile(p: Annotated[UploadFile, File()]):
        return {"file_size": p.size}
    
    
    @pytest.mark.parametrize(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Feb 21 13:01:31 GMT 2026
    - 11.1K bytes
    - Click Count (0)
  6. docs/de/docs/index.md

    <details markdown="1">
    <summary>Oder verwenden Sie <code>async def</code> ...</summary>
    
    Wenn Ihr Code `async` / `await` verwendet, benutzen Sie `async def`:
    
    ```Python hl_lines="7  12"
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    async def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: int, q: str | None = None):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:58:09 GMT 2026
    - 23.6K bytes
    - Click Count (1)
  7. docs/uk/docs/index.md

    <details markdown="1">
    <summary>Або використайте <code>async def</code>...</summary>
    
    Якщо ваш код використовує `async` / `await`, скористайтеся `async def`:
    
    ```Python hl_lines="7  12"
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    async def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: int, q: str | None = None):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:27:41 GMT 2026
    - 29.1K bytes
    - Click Count (0)
  8. docs/ja/docs/tutorial/testing.md

    **FastAPI** は開発者の利便性のために `fastapi.testclient` と同じ `starlette.testclient` を提供します。しかし、実際にはStarletteから直接渡されています。
    
    ///
    
    /// tip
    
    FastAPIアプリケーションへのリクエストの送信とは別に、テストで `async` 関数 (非同期データベース関数など) を呼び出したい場合は、高度なチュートリアルの[Async Tests](../advanced/async-tests.md) を参照してください。
    
    ///
    
    ## テストの分離 { #separating-tests }
    
    実際のアプリケーションでは、おそらくテストを別のファイルに保存します。
    
    また、**FastAPI** アプリケーションは、複数のファイル/モジュールなどで構成されている場合もあります。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 7.1K bytes
    - Click Count (0)
  9. docs/zh-hant/docs/tutorial/testing.md

    /// tip
    
    注意測試函式是一般的 `def`,不是 `async def`。
    
    而且對 client 的呼叫也都是一般呼叫,不需要使用 `await`。
    
    這讓你可以直接使用 `pytest`,不必費心處理非同步。
    
    ///
    
    /// note | 技術細節
    
    你也可以使用 `from starlette.testclient import TestClient`。
    
    **FastAPI** 為了方便開發者,也提供與 `starlette.testclient` 相同的 `fastapi.testclient`。但它其實直接來自 Starlette。
    
    ///
    
    /// tip
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 5.6K bytes
    - Click Count (0)
  10. docs/pt/docs/tutorial/testing.md

    ///
    
    /// tip | Dica
    
    Se você quiser chamar funções `async` em seus testes além de enviar solicitações à sua aplicação FastAPI (por exemplo, funções de banco de dados assíncronas), dê uma olhada em [Testes assíncronos](../advanced/async-tests.md) no tutorial avançado.
    
    ///
    
    ## Separando testes { #separating-tests }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:20:43 GMT 2026
    - 6.1K bytes
    - Click Count (0)
Back to Top