Home / Function/ init_per_thread_state() — requests Function Reference

init_per_thread_state() — requests Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

src/requests/auth.py lines 116–124

    def init_per_thread_state(self):
        # Ensure state is initialized just once per-thread
        if not hasattr(self._thread_local, "init"):
            self._thread_local.init = True
            self._thread_local.last_nonce = ""
            self._thread_local.nonce_count = 0
            self._thread_local.chal = {}
            self._thread_local.pos = None
            self._thread_local.num_401_calls = None

Domain

Subdomains

Called By

Frequently Asked Questions

What does init_per_thread_state() do?
init_per_thread_state() is a function in the requests codebase, defined in src/requests/auth.py.
Where is init_per_thread_state() defined?
init_per_thread_state() is defined in src/requests/auth.py at line 116.
What calls init_per_thread_state()?
init_per_thread_state() is called by 1 function(s): __call__.

Analyze Your Own Codebase

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

Try Supermodel Free