to_native_string() — requests Function Reference
Architecture documentation for the to_native_string() function in _internal_utils.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD 0ab29509_59a1_1f68_fae2_146376240019["to_native_string()"] ad9103ba_2c26_1ff0_c67d_e7f70c6f108c["_internal_utils.py"] 0ab29509_59a1_1f68_fae2_146376240019 -->|defined in| ad9103ba_2c26_1ff0_c67d_e7f70c6f108c fa72bb6a_120a_ce88_fe4e_28d8c4d3b882["_basic_auth_str()"] fa72bb6a_120a_ce88_fe4e_28d8c4d3b882 -->|calls| 0ab29509_59a1_1f68_fae2_146376240019 63cf6778_9f88_2740_3c09_2b2c4c8e761c["get_full_url()"] 63cf6778_9f88_2740_3c09_2b2c4c8e761c -->|calls| 0ab29509_59a1_1f68_fae2_146376240019 918832c2_0c83_1556_bca4_78b83a2cc415["prepare_method()"] 918832c2_0c83_1556_bca4_78b83a2cc415 -->|calls| 0ab29509_59a1_1f68_fae2_146376240019 77892816_404a_4492_b558_b565f63d2ad0["prepare_url()"] 77892816_404a_4492_b558_b565f63d2ad0 -->|calls| 0ab29509_59a1_1f68_fae2_146376240019 cf59faf9_2b09_589c_b9c7_f2e4c7d65c4d["prepare_headers()"] cf59faf9_2b09_589c_b9c7_f2e4c7d65c4d -->|calls| 0ab29509_59a1_1f68_fae2_146376240019 45e5de53_d23e_6c69_97ea_d5a29d1fcd7b["get_redirect_target()"] 45e5de53_d23e_6c69_97ea_d5a29d1fcd7b -->|calls| 0ab29509_59a1_1f68_fae2_146376240019 cbf6862f_d124_817f_3342_f1142c276f25["resolve_redirects()"] cbf6862f_d124_817f_3342_f1142c276f25 -->|calls| 0ab29509_59a1_1f68_fae2_146376240019 style 0ab29509_59a1_1f68_fae2_146376240019 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/requests/_internal_utils.py lines 26–36
def to_native_string(string, encoding="ascii"):
"""Given a string object, regardless of type, returns a representation of
that string in the native string type, encoding and decoding where
necessary. This assumes ASCII unless told otherwise.
"""
if isinstance(string, builtin_str):
out = string
else:
out = string.decode(encoding)
return out
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does to_native_string() do?
to_native_string() is a function in the requests codebase, defined in src/requests/_internal_utils.py.
Where is to_native_string() defined?
to_native_string() is defined in src/requests/_internal_utils.py at line 26.
What calls to_native_string()?
to_native_string() is called by 7 function(s): _basic_auth_str, get_full_url, get_redirect_target, prepare_headers, prepare_method, prepare_url, resolve_redirects.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free