Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 691196d

Browse files
matthewbelisle-wfvstinner
authored andcommitted
bpo-35116, urllib.parse: Document the new max_num_fields parameter (GH-10248)
1 parent c843a47 commit 691196d

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

Doc/library/urllib.parse.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ or on combining URL components into a URL string.
134134
returning :const:`None`.
135135

136136

137-
.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace')
137+
.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None)
138138

139139
Parse a query string given as a string argument (data of type
140140
:mimetype:`application/x-www-form-urlencoded`). Data are returned as a
@@ -155,6 +155,10 @@ or on combining URL components into a URL string.
155155
percent-encoded sequences into Unicode characters, as accepted by the
156156
:meth:`bytes.decode` method.
157157

158+
The optional argument *max_num_fields* is the maximum number of fields to
159+
read. If set, then throws a :exc:`ValueError` if there are more than
160+
*max_num_fields* fields read.
161+
158162
Use the :func:`urllib.parse.urlencode` function (with the ``doseq``
159163
parameter set to ``True``) to convert such dictionaries into query
160164
strings.
@@ -163,8 +167,11 @@ or on combining URL components into a URL string.
163167
.. versionchanged:: 3.2
164168
Add *encoding* and *errors* parameters.
165169

170+
.. versionchanged:: 3.6.8
171+
Added *max_num_fields* parameter.
172+
166173

167-
.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace')
174+
.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None)
168175

169176
Parse a query string given as a string argument (data of type
170177
: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.
184191
percent-encoded sequences into Unicode characters, as accepted by the
185192
:meth:`bytes.decode` method.
186193

194+
The optional argument *max_num_fields* is the maximum number of fields to
195+
read. If set, then throws a :exc:`ValueError` if there are more than
196+
*max_num_fields* fields read.
197+
187198
Use the :func:`urllib.parse.urlencode` function to convert such lists of pairs into
188199
query strings.
189200

190201
.. versionchanged:: 3.2
191202
Add *encoding* and *errors* parameters.
192203

204+
.. versionchanged:: 3.6.8
205+
Added *max_num_fields* parameter.
206+
193207

194208
.. function:: urlunparse(parts)
195209

0 commit comments

Comments
 (0)