Home / Function/ parse_list_header() — requests Function Reference

parse_list_header() — requests Function Reference

Architecture documentation for the parse_list_header() function in utils.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  9a9988d6_bd3b_3f66_965e_2ff796ea8395["parse_list_header()"]
  2c39b9da_e317_5e6c_bbac_8362bac2110c["utils.py"]
  9a9988d6_bd3b_3f66_965e_2ff796ea8395 -->|defined in| 2c39b9da_e317_5e6c_bbac_8362bac2110c
  afbe85d3_dee9_493b_5414_1e453dcc99d2["unquote_header_value()"]
  9a9988d6_bd3b_3f66_965e_2ff796ea8395 -->|calls| afbe85d3_dee9_493b_5414_1e453dcc99d2
  style 9a9988d6_bd3b_3f66_965e_2ff796ea8395 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/requests/utils.py lines 363–391

def parse_list_header(value):
    """Parse lists as described by RFC 2068 Section 2.

    In particular, parse comma-separated lists where the elements of
    the list may include quoted-strings.  A quoted-string could
    contain a comma.  A non-quoted string could have quotes in the
    middle.  Quotes are removed automatically after parsing.

    It basically works like :func:`parse_set_header` just that items
    may appear multiple times and case sensitivity is preserved.

    The return value is a standard :class:`list`:

    >>> parse_list_header('token, "quoted value"')
    ['token', 'quoted value']

    To create a header from the :class:`list` again, use the
    :func:`dump_header` function.

    :param value: a string with a list header.
    :return: :class:`list`
    :rtype: list
    """
    result = []
    for item in _parse_list_header(value):
        if item[:1] == item[-1:] == '"':
            item = unquote_header_value(item[1:-1])
        result.append(item)
    return result

Domain

Subdomains

Frequently Asked Questions

What does parse_list_header() do?
parse_list_header() is a function in the requests codebase, defined in src/requests/utils.py.
Where is parse_list_header() defined?
parse_list_header() is defined in src/requests/utils.py at line 363.
What does parse_list_header() call?
parse_list_header() calls 1 function(s): unquote_header_value.

Analyze Your Own Codebase

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

Try Supermodel Free