PyDocs

Nav

Internet Protocols and Support

parse_qs

urllib.parse

function (source) Deprecated 3.14
  • parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')
Deprecated since 3.14. Accepting objects with false values (like 0 and []) except empty strings and byte-like objects and None is now deprecated.
Parse a query given as a string argument.

Arguments:

qs: percent-encoded query string to be parsed

keep_blank_values: flag indicating whether blank values in
    percent-encoded queries should be treated as blank strings.
    A true value indicates that blanks should be retained as
    blank strings.  The default false value indicates that
    blank values are to be ignored and treated as if they were
    not included.

strict_parsing: flag indicating what to do with parsing errors.
    If false (the default), errors are silently ignored.
    If true, errors raise a ValueError exception.

encoding and errors: specify how to decode percent-encoded sequences
    into Unicode characters, as accepted by the bytes.decode() method.

max_num_fields: int. If set, then throws a ValueError if there
    are more than n fields read by parse_qsl().

separator: str. The symbol to use for separating the query arguments.
    Defaults to &.

Returns a dictionary.
Changed in 3.2, 3.8, 3.10
  • 3.2: Add encoding and errors parameters.
  • 3.8: Added max_num_fields parameter.
  • 3.10: Added separator parameter with the default value of &. Python versions earlier than Python 3.10 allowed using both ; and & as query parameter separator. This has been changed to allow only a single separator key, with & as the default separator.
0 Examples
No examples for urllib.parse/parse_qs.
See Also
No see-alsos for urllib.parse/parse_qs
0 Notes
No notes for parse_qs