diff options
author | matthewbelisle-wf <matthew.belisle@workiva.com> | 2018-10-30 20:30:19 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2018-10-30 20:30:19 (GMT) |
commit | 68f323715e6627c550d1e8ffed7e36f1bb4aa42b (patch) | |
tree | 45921f9f5ab446d7f924067d5eb83f91623be398 /Doc/library | |
parent | a80af770870937271865b5e2b05a2cfe40b024b6 (diff) | |
download | cpython-68f323715e6627c550d1e8ffed7e36f1bb4aa42b.zip cpython-68f323715e6627c550d1e8ffed7e36f1bb4aa42b.tar.gz cpython-68f323715e6627c550d1e8ffed7e36f1bb4aa42b.tar.bz2 |
bpo-35116, urllib.parse: Document the new max_num_fields parameter (GH-10247)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/urllib.parse.rst | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index 2d3488b..913e933 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -137,7 +137,7 @@ or on combining URL components into a URL string. returning :const:`None`. -.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace') +.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None) Parse a query string given as a string argument (data of type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a @@ -158,6 +158,10 @@ or on combining URL components into a URL string. percent-encoded sequences into Unicode characters, as accepted by the :meth:`bytes.decode` method. + The optional argument *max_num_fields* is the maximum number of fields to + read. If set, then throws a :exc:`ValueError` if there are more than + *max_num_fields* fields read. + Use the :func:`urllib.parse.urlencode` function (with the ``doseq`` parameter set to ``True``) to convert such dictionaries into query strings. @@ -166,8 +170,11 @@ or on combining URL components into a URL string. .. versionchanged:: 3.2 Add *encoding* and *errors* parameters. + .. versionchanged:: 3.8 + Added *max_num_fields* parameter. + -.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace') +.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None) Parse a query string given as a string argument (data of type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a list of @@ -187,12 +194,19 @@ or on combining URL components into a URL string. percent-encoded sequences into Unicode characters, as accepted by the :meth:`bytes.decode` method. + The optional argument *max_num_fields* is the maximum number of fields to + read. If set, then throws a :exc:`ValueError` if there are more than + *max_num_fields* fields read. + Use the :func:`urllib.parse.urlencode` function to convert such lists of pairs into query strings. .. versionchanged:: 3.2 Add *encoding* and *errors* parameters. + .. versionchanged:: 3.8 + Added *max_num_fields* parameter. + .. function:: urlunparse(parts) |