From 39da7a9d064c6ab37d5d8e6b479f0a7635785dc3 Mon Sep 17 00:00:00 2001 From: Matt Belisle Date: Tue, 30 Oct 2018 13:22:39 -0500 Subject: [PATCH 1/3] [3.6] Adding Doc/library entries for max_num_fields (cherry picked from commit 98ace4b856) Co-authored-by: Matt Belisle --- Doc/library/urllib.parse.rst | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index 1cc69e62e63318..83a432418d6b62 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -134,7 +134,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 @@ -155,6 +155,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 a flag for the maximum number of + fields to read. If set, then throws a :exc:`ValueError` if there are more + than *max_num_fields* fields read. Default is *None*. + Use the :func:`urllib.parse.urlencode` function (with the ``doseq`` parameter set to ``True``) to convert such dictionaries into query strings. @@ -163,8 +167,11 @@ or on combining URL components into a URL string. .. versionchanged:: 3.2 Add *encoding* and *errors* parameters. + .. versionchanged:: 3.6.8 + Added *max_num_fields* param. + -.. 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 @@ -184,12 +191,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 a flag for the maximum number of + fields to read. If set, then throws a :exc:`ValueError` if there are more + than *max_num_fields* fields read. Default is *None*. + 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.6.8 + Added *max_num_fields* param. + .. function:: urlunparse(parts) From 084495f1651ee1da90f258c7aabac639da0388e3 Mon Sep 17 00:00:00 2001 From: Matt Belisle Date: Tue, 30 Oct 2018 14:54:23 -0500 Subject: [PATCH 2/3] param -> parameter --- Doc/library/urllib.parse.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index 83a432418d6b62..21424f8bd2adf8 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -168,7 +168,7 @@ or on combining URL components into a URL string. Add *encoding* and *errors* parameters. .. versionchanged:: 3.6.8 - Added *max_num_fields* param. + Added *max_num_fields* parameter. .. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None) @@ -202,7 +202,7 @@ or on combining URL components into a URL string. Add *encoding* and *errors* parameters. .. versionchanged:: 3.6.8 - Added *max_num_fields* param. + Added *max_num_fields* parameter. .. function:: urlunparse(parts) From 2b29e677c543757cea1d64b90847e6ca38d8e7e5 Mon Sep 17 00:00:00 2001 From: Matt Belisle Date: Tue, 30 Oct 2018 15:17:36 -0500 Subject: [PATCH 3/3] Changing max_num_fields wording --- Doc/library/urllib.parse.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index 21424f8bd2adf8..d991254d5ca1e8 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -155,9 +155,9 @@ 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 a flag for the maximum number of - fields to read. If set, then throws a :exc:`ValueError` if there are more - than *max_num_fields* fields read. Default is *None*. + 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 @@ -191,9 +191,9 @@ 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 a flag for the maximum number of - fields to read. If set, then throws a :exc:`ValueError` if there are more - than *max_num_fields* fields read. Default is *None*. + 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.