MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / parse_qs

Function parse_qs

tools/python-3.11.9-amd64/Lib/urllib/parse.py:687–726  ·  view source on GitHub ↗

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

(qs, keep_blank_values=False, strict_parsing=False,
             encoding='utf-8', errors='replace', max_num_fields=None, separator='&')

Source from the content-addressed store, hash-verified

685
686
687def parse_qs(qs, keep_blank_values=False, strict_parsing=False,
688 encoding='utf-8', errors='replace', max_num_fields=None, separator='&'):
689 """Parse a query given as a string argument.
690
691 Arguments:
692
693 qs: percent-encoded query string to be parsed
694
695 keep_blank_values: flag indicating whether blank values in
696 percent-encoded queries should be treated as blank strings.
697 A true value indicates that blanks should be retained as
698 blank strings. The default false value indicates that
699 blank values are to be ignored and treated as if they were
700 not included.
701
702 strict_parsing: flag indicating what to do with parsing errors.
703 If false (the default), errors are silently ignored.
704 If true, errors raise a ValueError exception.
705
706 encoding and errors: specify how to decode percent-encoded sequences
707 into Unicode characters, as accepted by the bytes.decode() method.
708
709 max_num_fields: int. If set, then throws a ValueError if there
710 are more than n fields read by parse_qsl().
711
712 separator: str. The symbol to use for separating the query arguments.
713 Defaults to &.
714
715 Returns a dictionary.
716 """
717 parsed_result = {}
718 pairs = parse_qsl(qs, keep_blank_values, strict_parsing,
719 encoding=encoding, errors=errors,
720 max_num_fields=max_num_fields, separator=separator)
721 for name, value in pairs:
722 if name in parsed_result:
723 parsed_result[name].append(value)
724 else:
725 parsed_result[name] = [value]
726 return parsed_result
727
728
729def parse_qsl(qs, keep_blank_values=False, strict_parsing=False,

Callers

nothing calls this directly

Calls 2

parse_qslFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected