Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for calls (0.22 sec)

  1. fastapi/dependencies/models.py

            self.name = name
            self.call = call
            self.use_cache = use_cache
            # Store the path to be able to re-generate a dependable from it in overrides
            self.path = path
            # Save the cache key at creation to optimize performance
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 2.4K bytes
    - Viewed (0)
  2. tests/test_ws_router.py

                    return await app(scope, receive, send)  # pragma: no cover
    
                async def call_next():
                    return await app(scope, receive, send)
    
                websocket = WebSocket(scope, receive=receive, send=send)
                return await middleware_func(websocket, call_next)
    
            return wrapped_app
    
        return middleware_constructor
    
    
    def test_depend_validation():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jun 11 19:08:14 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  3. tests/test_dependency_contextvars.py

        yield request_state
        legacy_request_state_context_var.reset(contextvar_token)
    
    
    @app.middleware("http")
    async def custom_middleware(
        request: Request, call_next: Callable[[Request], Awaitable[Response]]
    ):
        response = await call_next(request)
        response.headers["custom"] = "foo"
        return response
    
    
    @app.get("/user", dependencies=[Depends(set_up_request_state_dependency)])
    def get_user():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Feb 17 12:40:12 GMT 2022
    - 1.5K bytes
    - Viewed (0)
  4. docs_src/dependencies/tutorial011_an_py39.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI
    
    app = FastAPI()
    
    
    class FixedContentQueryChecker:
        def __init__(self, fixed_content: str):
            self.fixed_content = fixed_content
    
        def __call__(self, q: str = ""):
            if q:
                return self.fixed_content in q
            return False
    
    
    checker = FixedContentQueryChecker("bar")
    
    
    @app.get("/query-checker/")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 544 bytes
    - Viewed (0)
  5. tests/test_schema_extra_examples.py

                    example="cookie_overridden",
                    examples=["cookie1", "cookie2"],
                ),
            ):
                return data
    
        return app
    
    
    def test_call_api():
        app = create_app()
        client = TestClient(app)
        response = client.post("/schema_extra/", json={"data": "Foo"})
        assert response.status_code == 200, response.text
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 37.7K bytes
    - Viewed (0)
  6. docs_src/sql_databases/sql_app_py39/alt_main.py

    models.Base.metadata.create_all(bind=engine)
    
    app = FastAPI()
    
    
    @app.middleware("http")
    async def db_session_middleware(request: Request, call_next):
        response = Response("Internal server error", status_code=500)
        try:
            request.state.db = SessionLocal()
            response = await call_next(request)
        finally:
            request.state.db.close()
        return response
    
    
    # Dependency
    def get_db(request: Request):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  7. fastapi/_compat.py

                by_alias: bool = True,
                exclude_unset: bool = False,
                exclude_defaults: bool = False,
                exclude_none: bool = False,
            ) -> Any:
                # What calls this code passes a value that already called
                # self._type_adapter.validate_python(value)
                return self._type_adapter.dump_python(
                    value,
                    mode=mode,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 22.6K bytes
    - Viewed (0)
  8. fastapi/dependencies/utils.py

            return True
        dunder_call = getattr(call, "__call__", None)  # noqa: B004
        return inspect.isasyncgenfunction(dunder_call)
    
    
    def is_gen_callable(call: Callable[..., Any]) -> bool:
        if inspect.isgeneratorfunction(call):
            return True
        dunder_call = getattr(call, "__call__", None)  # noqa: B004
        return inspect.isgeneratorfunction(dunder_call)
    
    
    async def solve_generator(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
  9. fastapi/security/api_key.py

                name=name,
                description=description,
            )
            self.scheme_name = scheme_name or self.__class__.__name__
            self.auto_error = auto_error
    
        async def __call__(self, request: Request) -> Optional[str]:
            api_key = request.query_params.get(self.model.name)
            if not api_key:
                if self.auto_error:
                    raise HTTPException(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 23 22:29:18 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  10. tests/test_openapi_examples.py

                },
                "Cookie Two": {
                    "value": "cookie2",
                },
            },
        ),
    ):
        return data
    
    
    client = TestClient(app)
    
    
    def test_call_api():
        response = client.post("/examples/", json={"data": "example1"})
        assert response.status_code == 200, response.text
    
        response = client.get("/path_examples/foo")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 17K bytes
    - Viewed (0)
Back to top