_parse_content_type_header() — requests Function Reference
Architecture documentation for the _parse_content_type_header() function in utils.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD 3e36ad14_0ff8_5ae4_5075_977b4fa6bc08["_parse_content_type_header()"] 2c39b9da_e317_5e6c_bbac_8362bac2110c["utils.py"] 3e36ad14_0ff8_5ae4_5075_977b4fa6bc08 -->|defined in| 2c39b9da_e317_5e6c_bbac_8362bac2110c 9ab5b77a_1e93_5426_2b6e_540e378c20b4["get_encoding_from_headers()"] 9ab5b77a_1e93_5426_2b6e_540e378c20b4 -->|calls| 3e36ad14_0ff8_5ae4_5075_977b4fa6bc08 style 3e36ad14_0ff8_5ae4_5075_977b4fa6bc08 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/requests/utils.py lines 502–524
def _parse_content_type_header(header):
"""Returns content type and parameters from given header
:param header: string
:return: tuple containing content type and dictionary of
parameters
"""
tokens = header.split(";")
content_type, params = tokens[0].strip(), tokens[1:]
params_dict = {}
items_to_strip = "\"' "
for param in params:
param = param.strip()
if param:
key, value = param, True
index_of_equals = param.find("=")
if index_of_equals != -1:
key = param[:index_of_equals].strip(items_to_strip)
value = param[index_of_equals + 1 :].strip(items_to_strip)
params_dict[key.lower()] = value
return content_type, params_dict
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does _parse_content_type_header() do?
_parse_content_type_header() is a function in the requests codebase, defined in src/requests/utils.py.
Where is _parse_content_type_header() defined?
_parse_content_type_header() is defined in src/requests/utils.py at line 502.
What calls _parse_content_type_header()?
_parse_content_type_header() is called by 1 function(s): get_encoding_from_headers.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free