Home / Function/ __call__() — fastapi Function Reference

__call__() — fastapi Function Reference

Architecture documentation for the __call__() function in http.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  b744049d_60fe_b80e_7c2a_c093693fd243["__call__()"]
  9620b194_84a3_fbe6_126b_b915d25890fd["HTTPBearer"]
  b744049d_60fe_b80e_7c2a_c093693fd243 -->|defined in| 9620b194_84a3_fbe6_126b_b915d25890fd
  8a4f3cb1_2bb3_9484_ab7e_5424511db588["make_not_authenticated_error()"]
  b744049d_60fe_b80e_7c2a_c093693fd243 -->|calls| 8a4f3cb1_2bb3_9484_ab7e_5424511db588
  21dea0a2_f30d_d3da_ce48_734fa9836d52["get_authorization_scheme_param()"]
  b744049d_60fe_b80e_7c2a_c093693fd243 -->|calls| 21dea0a2_f30d_d3da_ce48_734fa9836d52
  style b744049d_60fe_b80e_7c2a_c093693fd243 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/security/http.py lines 305–320

    async def __call__(
        self, request: Request
    ) -> Optional[HTTPAuthorizationCredentials]:
        authorization = request.headers.get("Authorization")
        scheme, credentials = get_authorization_scheme_param(authorization)
        if not (authorization and scheme and credentials):
            if self.auto_error:
                raise self.make_not_authenticated_error()
            else:
                return None
        if scheme.lower() != "bearer":
            if self.auto_error:
                raise self.make_not_authenticated_error()
            else:
                return None
        return HTTPAuthorizationCredentials(scheme=scheme, credentials=credentials)

Domain

Subdomains

Frequently Asked Questions

What does __call__() do?
__call__() is a function in the fastapi codebase, defined in fastapi/security/http.py.
Where is __call__() defined?
__call__() is defined in fastapi/security/http.py at line 305.
What does __call__() call?
__call__() calls 2 function(s): get_authorization_scheme_param, make_not_authenticated_error.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free