Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for dep0 (0.35 sec)

  1. tests/test_security_scopes_dont_propagate.py

        return scopes.scopes
    
    
    async def dep3(
        dep1: Annotated[list[str], Security(security1, scopes=["scope1"])],
        dep2: Annotated[list[str], Security(security2, scopes=["scope2"])],
    ):
        return {"dep1": dep1, "dep2": dep2}
    
    
    app = FastAPI()
    
    
    @app.get("/scopes")
    def get_scopes(
        dep3: Annotated[dict[str, Any], Security(dep3, scopes=["scope3"])],
    ):
        return dep3
    
    
    client = TestClient(app)
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 973 bytes
    - Viewed (0)
  2. tests/test_ws_dependencies.py

    async def index(websocket: WebSocket, deps: DepList):
        await websocket.accept()
        await websocket.send_text(json.dumps(deps))
        await websocket.close()
    
    
    @router.websocket("/router", dependencies=[create_dependency("routerindex")])
    async def routerindex(websocket: WebSocket, deps: DepList):
        await websocket.accept()
        await websocket.send_text(json.dumps(deps))
        await websocket.close()
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 2.1K bytes
    - Viewed (0)
  3. tests/benchmarks/test_general_performance.py

    
    @app.get("/sync/dict-no-response-model")
    def sync_dict_no_response_model():
        return {"name": "foo", "value": 123}
    
    
    @app.get("/sync/dict-with-response-model", response_model=ItemOut)
    def sync_dict_with_response_model(
        dep: Annotated[int, Depends(dep_b)],
    ):
        return {"name": "foo", "value": 123, "dep": dep}
    
    
    @app.get("/sync/model-no-response-model")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 20:40:26 UTC 2025
    - 11.1K bytes
    - Viewed (0)
  4. tests/test_generic_parameterless_depends.py

    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    T = TypeVar("T")
    
    Dep = Annotated[T, Depends()]
    
    
    class A:
        pass
    
    
    class B:
        pass
    
    
    @app.get("/a")
    async def a(dep: Dep[A]):
        return {"cls": dep.__class__.__name__}
    
    
    @app.get("/b")
    async def b(dep: Dep[B]):
        return {"cls": dep.__class__.__name__}
    
    
    client = TestClient(app)
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.8K bytes
    - Viewed (0)
  5. tests/test_ambiguous_params.py

                "Cannot specify `Depends` in `Annotated` and default value"
                " together for 'foo'"
            ),
        ):
    
            @app.get("/")
            async def get2(foo: Annotated[int, Depends(dep)] = Depends(dep)):
                pass  # pragma: nocover
    
        with pytest.raises(
            AssertionError,
            match=(
                "Cannot specify a FastAPI annotation in `Annotated` and `Depends` as a"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 2K bytes
    - Viewed (1)
  6. docs/es/docs/tutorial/dependencies/dependencies-with-yield.md

    participant handler as Exception handler
    participant dep as Dep with yield
    participant operation as Path Operation
    participant tasks as Background tasks
    
        Note over client,operation: Puede lanzar excepciones, incluyendo HTTPException
        client ->> dep: Iniciar request
        Note over dep: Ejecutar código hasta yield
        opt raise Exception
            dep -->> handler: Lanzar Exception
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 13.7K bytes
    - Viewed (0)
  7. tests/test_stringified_annotations_simple.py

    from fastapi.testclient import TestClient
    
    from .utils import needs_py310
    
    
    class Dep:
        def __call__(self, request: Request):
            return "test"
    
    
    @needs_py310
    def test_stringified_annotations():
        app = FastAPI()
    
        client = TestClient(app)
    
        @app.get("/test/")
        def call(test: Annotated[str, Depends(Dep())]):
            return {"test": test}
    
        response = client.get("/test")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 545 bytes
    - Viewed (0)
  8. docs/ru/docs/tutorial/dependencies/dependencies-with-yield.md

    participant client as Client
    participant handler as Exception handler
    participant dep as Dep with yield
    participant operation as Path Operation
    participant tasks as Background tasks
    
        Note over client,operation: Can raise exceptions, including HTTPException
        client ->> dep: Start request
        Note over dep: Run code up to yield
        opt raise Exception
            dep -->> handler: Raise Exception
            handler -->> client: HTTP error response
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 19.7K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_dependencies/test_tutorial008.py

    import pytest
    from fastapi import Depends, FastAPI
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(
        name="module",
        params=[
            "tutorial008_py39",
            # Fails with `NameError: name 'DepA' is not defined`
            pytest.param("tutorial008_an_py39", marks=pytest.mark.xfail),
        ],
    )
    def get_module(request: pytest.FixtureRequest):
        mod_name = f"docs_src.dependencies.{request.param}"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.4K bytes
    - Viewed (0)
  10. docs/pt/docs/tutorial/dependencies/dependencies-with-yield.md

    participant handler as Manipulador de exceções
    participant dep as Dep com yield
    participant operation as Operação de Rota
    participant tasks as Tarefas de Background
    
        Note over client,operation: pode lançar exceções, incluindo HTTPException
        client ->> dep: Iniciar requisição
        Note over dep: Executar código até o yield
        opt lançar Exceção
            dep -->> handler: lançar Exceção
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 14.2K bytes
    - Viewed (0)
Back to top