Home / Function/ __call__() — requests Function Reference

__call__() — requests Function Reference

Architecture documentation for the __call__() function in auth.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  19624f9a_1446_1a92_8704_bca792b9b1fa["__call__()"]
  aa32083c_418b_f1ff_9e66_cf1a12e8a8ee["HTTPDigestAuth"]
  19624f9a_1446_1a92_8704_bca792b9b1fa -->|defined in| aa32083c_418b_f1ff_9e66_cf1a12e8a8ee
  cb809e14_f57d_9c3d_4f4e_7538910c95a0["init_per_thread_state()"]
  19624f9a_1446_1a92_8704_bca792b9b1fa -->|calls| cb809e14_f57d_9c3d_4f4e_7538910c95a0
  7a5e3fcd_3d53_bb5a_33e1_2ec03991bb2c["build_digest_header()"]
  19624f9a_1446_1a92_8704_bca792b9b1fa -->|calls| 7a5e3fcd_3d53_bb5a_33e1_2ec03991bb2c
  style 19624f9a_1446_1a92_8704_bca792b9b1fa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/requests/auth.py lines 285–303

    def __call__(self, r):
        # Initialize per-thread state, if needed
        self.init_per_thread_state()
        # If we have a saved nonce, skip the 401
        if self._thread_local.last_nonce:
            r.headers["Authorization"] = self.build_digest_header(r.method, r.url)
        try:
            self._thread_local.pos = r.body.tell()
        except AttributeError:
            # In the case of HTTPDigestAuth being reused and the body of
            # the previous request was a file-like object, pos has the
            # file position of the previous body. Ensure it's set to
            # None.
            self._thread_local.pos = None
        r.register_hook("response", self.handle_401)
        r.register_hook("response", self.handle_redirect)
        self._thread_local.num_401_calls = 1

        return r

Domain

Subdomains

Frequently Asked Questions

What does __call__() do?
__call__() is a function in the requests codebase, defined in src/requests/auth.py.
Where is __call__() defined?
__call__() is defined in src/requests/auth.py at line 285.
What does __call__() call?
__call__() calls 2 function(s): build_digest_header, init_per_thread_state.

Analyze Your Own Codebase

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

Try Supermodel Free