prepare_headers() — requests Function Reference
Architecture documentation for the prepare_headers() function in models.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD cf59faf9_2b09_589c_b9c7_f2e4c7d65c4d["prepare_headers()"] c8cfcd0c_a36a_3124_6cd4_1516b06c63b3["PreparedRequest"] cf59faf9_2b09_589c_b9c7_f2e4c7d65c4d -->|defined in| c8cfcd0c_a36a_3124_6cd4_1516b06c63b3 3fc6c343_3d70_670f_636f_1fcab0f8a681["prepare()"] 3fc6c343_3d70_670f_636f_1fcab0f8a681 -->|calls| cf59faf9_2b09_589c_b9c7_f2e4c7d65c4d 342c3122_113c_32a4_2286_94935f7ac0a8["items()"] cf59faf9_2b09_589c_b9c7_f2e4c7d65c4d -->|calls| 342c3122_113c_32a4_2286_94935f7ac0a8 38488cd6_56a1_f8ac_428d_9118e232a87c["check_header_validity()"] cf59faf9_2b09_589c_b9c7_f2e4c7d65c4d -->|calls| 38488cd6_56a1_f8ac_428d_9118e232a87c 0ab29509_59a1_1f68_fae2_146376240019["to_native_string()"] cf59faf9_2b09_589c_b9c7_f2e4c7d65c4d -->|calls| 0ab29509_59a1_1f68_fae2_146376240019 style cf59faf9_2b09_589c_b9c7_f2e4c7d65c4d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/requests/models.py lines 485–494
def prepare_headers(self, headers):
"""Prepares the given HTTP headers."""
self.headers = CaseInsensitiveDict()
if headers:
for header in headers.items():
# Raise exception on invalid header value.
check_header_validity(header)
name, value = header
self.headers[to_native_string(name)] = value
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does prepare_headers() do?
prepare_headers() is a function in the requests codebase, defined in src/requests/models.py.
Where is prepare_headers() defined?
prepare_headers() is defined in src/requests/models.py at line 485.
What does prepare_headers() call?
prepare_headers() calls 3 function(s): check_header_validity, items, to_native_string.
What calls prepare_headers()?
prepare_headers() is called by 1 function(s): prepare.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free