Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 560 for DEPENDENCIES (0.07 seconds)

  1. docs/en/docs/tutorial/dependencies/dependencies-with-yield.md

    In the same way, you can use `finally` to make sure the exit steps are executed, no matter if there was an exception or not.
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[3,5] *}
    
    ## Sub-dependencies with `yield` { #sub-dependencies-with-yield }
    
    You can have sub-dependencies and "trees" of sub-dependencies of any size and shape, and any or all of them can use `yield`.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 12.6K bytes
    - Click Count (0)
  2. docs/ko/docs/tutorial/dependencies/dependencies-with-yield.md

    응답을 생성하기 전에는 `yield`문을 포함하여 그 이전의 코드만이 실행됩니다:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[2:4] *}
    
    yield된 값은 *경로 처리* 및 다른 의존성들에 주입되는 값 입니다:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[4] *}
    
    `yield`문 다음의 코드는 응답을 생성한 후 실행됩니다:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[5:6] *}
    
    /// tip
    
    `async` 함수와 일반 함수 모두 사용할 수 있습니다.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:06:26 GMT 2026
    - 14.3K bytes
    - Click Count (0)
  3. docs/zh-hant/docs/tutorial/dependencies/dependencies-with-yield.md

    例如,你可以用它建立一個資料庫 session,並在完成後關閉。
    
    只有 `yield` 之前(含 `yield` 本身)的程式碼會在產生回應之前執行:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[2:4] *}
    
    由 `yield` 產生的值會被注入到路徑操作(path operation)與其他相依中:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[4] *}
    
    位於 `yield` 之後的程式碼會在回應之後執行:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[5:6] *}
    
    /// tip
    
    你可以使用 `async` 或一般函式。
    
    **FastAPI** 都會正確處理,和一般相依相同。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 11.9K bytes
    - Click Count (0)
  4. docs/zh/docs/tutorial/dependencies/dependencies-with-yield.md

    例如,你可以用这种方式创建一个数据库会话,并在完成后将其关闭。
    
    在创建响应之前,只会执行 `yield` 语句及其之前的代码:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[2:4] *}
    
    `yield` 产生的值会注入到 *路径操作* 和其他依赖项中:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[4] *}
    
    `yield` 语句后面的代码会在响应之后执行:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[5:6] *}
    
    /// tip | 提示
    
    你可以使用 `async` 或普通函数。
    
    **FastAPI** 会像处理普通依赖一样对它们进行正确处理。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 12.1K bytes
    - Click Count (0)
  5. docs/ja/docs/tutorial/dependencies/dependencies-with-yield.md

    例えば、これを使ってデータベースセッションを作成し、終了後にそれを閉じることができます。
    
    レスポンスを作成する前に、`yield`文より前のコード(および`yield`文を含む)が実行されます:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[2:4] *}
    
    生成された値は、*path operations*や他の依存関係に注入されるものです:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[4] *}
    
    `yield`文に続くコードは、レスポンスの後に実行されます:
    
    {* ../../docs_src/dependencies/tutorial007_py310.py hl[5:6] *}
    
    /// tip | 豆知識
    
    `async`や通常の関数を使用することができます。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 15.4K bytes
    - Click Count (0)
  6. docs/en/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md

    The *path operation decorator* receives an optional argument `dependencies`.
    
    It should be a `list` of `Depends()`:
    
    {* ../../docs_src/dependencies/tutorial006_an_py310.py hl[19] *}
    
    These dependencies will be executed/solved the same way as normal dependencies. But their value (if they return any) won't be passed to your *path operation function*.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 2.9K bytes
    - Click Count (0)
  7. docs/ja/docs/tutorial/dependencies/dependencies-in-path-operation-decorators.md

    場合によっては、*path operation 関数*の中で依存関係の戻り値を実際には必要としないことがあります。
    
    または、依存関係が値を返さない場合もあります。
    
    しかし、それでも実行・解決される必要があります。
    
    そのような場合、`Depends` で *path operation 関数* のパラメータを宣言する代わりに、*path operation デコレータ*に `dependencies` の `list` を追加できます。
    
    ## *path operation デコレータ*に`dependencies`を追加 { #add-dependencies-to-the-path-operation-decorator }
    
    *path operation デコレータ*はオプション引数`dependencies`を受け取ります。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 3.6K bytes
    - Click Count (0)
  8. fastapi/.agents/skills/fastapi/references/dependencies.md

    Use dependencies when:
    
    * They can't be declared in Pydantic validation and require additional logic
    * The logic depends on external resources or could block in any other way
    * Other dependencies need their results (it's a sub-dependency)
    * The logic can be shared by multiple endpoints to do things like error early, authentication, etc.
    * They need to handle cleanup (e.g., DB sessions, file handles), using dependencies with `yield`
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 01 10:05:57 GMT 2026
    - 3.2K bytes
    - Click Count (0)
  9. docs/en/docs/tutorial/dependencies/global-dependencies.md

    # Global Dependencies { #global-dependencies }
    
    For some types of applications you might want to add dependencies to the whole application.
    
    Similar to the way you can [add `dependencies` to the *path operation decorators*](dependencies-in-path-operation-decorators.md), you can add them to the `FastAPI` application.
    
    In that case, they will be applied to all the *path operations* in the application:
    
    {* ../../docs_src/dependencies/tutorial012_an_py310.py hl[17] *}
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 1K bytes
    - Click Count (0)
  10. docs/zh-hant/docs/tutorial/dependencies/global-dependencies.md

    # 全域依賴 { #global-dependencies }
    
    在某些類型的應用程式中,你可能想為整個應用程式新增依賴。
    
    類似於你可以在[路徑操作(path operation)的裝飾器中新增 `dependencies`](dependencies-in-path-operation-decorators.md) 的方式,你也可以把它們加到 `FastAPI` 應用程式上。
    
    在這種情況下,它們會套用到應用程式中的所有路徑操作:
    
    {* ../../docs_src/dependencies/tutorial012_an_py310.py hl[17] *}
    
    而且,在[將 `dependencies` 新增到路徑操作裝飾器](dependencies-in-path-operation-decorators.md) 那一節中的所有概念依然適用,只是這裡是套用到整個應用中的所有路徑操作。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 1K bytes
    - Click Count (0)
Back to Top