prepare_auth() — requests Function Reference
Architecture documentation for the prepare_auth() function in models.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD bea876a9_383a_fe0e_3e83_080ef6697c9f["prepare_auth()"] c8cfcd0c_a36a_3124_6cd4_1516b06c63b3["PreparedRequest"] bea876a9_383a_fe0e_3e83_080ef6697c9f -->|defined in| c8cfcd0c_a36a_3124_6cd4_1516b06c63b3 3fc6c343_3d70_670f_636f_1fcab0f8a681["prepare()"] 3fc6c343_3d70_670f_636f_1fcab0f8a681 -->|calls| bea876a9_383a_fe0e_3e83_080ef6697c9f 18349e5e_3ab4_19be_23d5_20c1111b761b["rebuild_auth()"] 18349e5e_3ab4_19be_23d5_20c1111b761b -->|calls| bea876a9_383a_fe0e_3e83_080ef6697c9f ad57bfe9_2bba_ea6e_5e85_44c51303ed35["prepare_content_length()"] bea876a9_383a_fe0e_3e83_080ef6697c9f -->|calls| ad57bfe9_2bba_ea6e_5e85_44c51303ed35 1a78d81a_ddf9_f329_5c88_eabcf1bdece2["get_auth_from_url()"] bea876a9_383a_fe0e_3e83_080ef6697c9f -->|calls| 1a78d81a_ddf9_f329_5c88_eabcf1bdece2 0aace64c_6424_62be_3052_5ea0e8ae90d3["update()"] bea876a9_383a_fe0e_3e83_080ef6697c9f -->|calls| 0aace64c_6424_62be_3052_5ea0e8ae90d3 style bea876a9_383a_fe0e_3e83_080ef6697c9f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/requests/models.py lines 590–610
def prepare_auth(self, auth, url=""):
"""Prepares the given HTTP auth data."""
# If no Auth is explicitly provided, extract it from the URL first.
if auth is None:
url_auth = get_auth_from_url(self.url)
auth = url_auth if any(url_auth) else None
if auth:
if isinstance(auth, tuple) and len(auth) == 2:
# special-case basic HTTP auth
auth = HTTPBasicAuth(*auth)
# Allow auth to make its changes.
r = auth(self)
# Update self to reflect the auth changes.
self.__dict__.update(r.__dict__)
# Recompute Content-Length
self.prepare_content_length(self.body)
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does prepare_auth() do?
prepare_auth() is a function in the requests codebase, defined in src/requests/models.py.
Where is prepare_auth() defined?
prepare_auth() is defined in src/requests/models.py at line 590.
What does prepare_auth() call?
prepare_auth() calls 3 function(s): get_auth_from_url, prepare_content_length, update.
What calls prepare_auth()?
prepare_auth() is called by 2 function(s): prepare, rebuild_auth.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free