Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 41 - 50 of 57 for include_router (0.09 seconds)

  1. tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py

        return {"token": token}
    
    
    @router.post("/items/")
    async def create_item(
        token: str | None = Security(oauth2_scheme, scopes=["read", "write"]),
    ):
        return {"token": token}
    
    
    app.include_router(router)
    
    client = TestClient(app)
    
    
    def test_root():
        response = client.get("/", headers={"Authorization": "Bearer testtoken"})
        assert response.status_code == 200, response.text
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 6.6K bytes
    - Click Count (0)
  2. docs/en/docs/release-notes.md

    That means that, for example, to apply authentication to all the *path operations* in a router it would end up being done in a different file, instead of keeping related logic together.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Apr 03 12:07:04 GMT 2026
    - 631K bytes
    - Click Count (0)
  3. docs/es/docs/advanced/testing-dependencies.md

    La dependencia original podría ser utilizada en una *path operation function*, un *path operation decorator* (cuando no usas el valor de retorno), una llamada a `.include_router()`, etc.
    
    FastAPI todavía podrá sobrescribirla.
    
    ///
    
    Entonces puedes restablecer las dependencias sobreescritas (eliminarlas) configurando `app.dependency_overrides` para que sea un `dict` vacío:
    
    ```Python
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 13 13:41:41 GMT 2026
    - 2.6K bytes
    - Click Count (0)
  4. docs/uk/docs/tutorial/bigger-applications.md

    /// info | Інформація
    
    `users.router` містить `APIRouter` у файлі `app/routers/users.py`.
    
    А `items.router` містить `APIRouter` у файлі `app/routers/items.py`.
    
    ///
    
    За допомогою `app.include_router()` ми можемо додати кожен `APIRouter` до основного застосунку `FastAPI`.
    
    Це включить усі маршрути з цього router'а як частину застосунку.
    
    /// note | Технічні деталі
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:27:41 GMT 2026
    - 27.4K bytes
    - Click Count (0)
  5. docs/ko/docs/advanced/testing-dependencies.md

    {* ../../docs_src/dependency_testing/tutorial001_an_py310.py hl[26:27,30] *}
    
    /// tip | 팁
    
    **FastAPI** 애플리케이션 어디에서든 사용된 의존성에 대해 오버라이드를 설정할 수 있습니다.
    
    원래 의존성은 *경로 처리 함수*, *경로 처리 데코레이터*(반환값을 사용하지 않는 경우), `.include_router()` 호출 등에서 사용될 수 있습니다.
    
    FastAPI는 여전히 이를 오버라이드할 수 있습니다.
    
    ///
    
    그런 다음, `app.dependency_overrides`를 빈 `dict`로 설정하여 오버라이드를 재설정(제거)할 수 있습니다:
    
    ```Python
    app.dependency_overrides = {}
    ```
    
    /// tip | 팁
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Jan 11 00:15:26 GMT 2026
    - 2.8K bytes
    - Click Count (0)
  6. tests/test_annotated.py

        app = FastAPI()
    
        router = APIRouter(prefix="/nested")
    
        @router.get("/test")
        async def test(var: Annotated[str, Query()] = "bar"):
            return {"foo": var}
    
        app.include_router(router)
    
        client = TestClient(app)
    
        response = client.get("/nested/test")
        assert response.status_code == 200
        assert response.json() == {"foo": "bar"}
    
    
    def test_openapi_schema():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 10.5K bytes
    - Click Count (0)
  7. docs/ja/docs/advanced/testing-dependencies.md

    {* ../../docs_src/dependency_testing/tutorial001_an_py310.py hl[26:27,30] *}
    
    /// tip | 豆知識
    
    アプリケーション内のどこで使われている依存関係に対しても、依存関係のオーバーライドを設定できます。
    
    元の依存関係は、*path operation 関数*、*path operation デコレータ*(戻り値を使わない場合)、`.include_router()` の呼び出しなど、さまざまな場所で使われていてもかまいません。
    
    FastAPI はそれでもオーバーライドできます。
    
    ///
    
    その後、`app.dependency_overrides` を空の `dict` に設定することで、オーバーライドをリセット(削除)できます:
    
    ```Python
    app.dependency_overrides = {}
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 13 15:24:30 GMT 2026
    - 3K bytes
    - Click Count (0)
  8. tests/test_additional_responses_router.py

        responses={
            "400": {"description": "Error with str"},
            "5XX": {"model": ResponseModel},
            "default": {"model": ResponseModel},
        },
    )
    async def d():
        return "d"
    
    
    app.include_router(router)
    
    
    client = TestClient(app)
    
    
    def test_a():
        response = client.get("/a")
        assert response.status_code == 200, response.text
        assert response.json() == "a"
    
    
    def test_b():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 5.6K bytes
    - Click Count (0)
  9. tests/test_sub_callbacks.py

                (e.g. "payment successful").
        """
        # Send the invoice, collect the money, send the notification (the callback)
        return {"msg": "Invoice received"}
    
    
    app.include_router(subrouter, callbacks=events_callback_router.routes)
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.post(
            "/invoices/", json={"id": "fooinvoice", "customer": "John", "total": 5.3}
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Feb 17 09:59:14 GMT 2026
    - 14.3K bytes
    - Click Count (0)
  10. docs/fr/docs/advanced/testing-dependencies.md

    La dépendance originale peut être utilisée dans une fonction de chemin d'accès, un décorateur de chemin d'accès (quand vous n’utilisez pas la valeur de retour), un appel à `.include_router()`, etc.
    
    FastAPI pourra toujours la surcharger.
    
    ///
    
    Vous pouvez ensuite réinitialiser vos surcharges (les supprimer) en affectant à `app.dependency_overrides` un `dict` vide :
    
    ```Python
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Feb 14 08:12:41 GMT 2026
    - 2.6K bytes
    - Click Count (0)
Back to Top