summaryrefslogtreecommitdiffstats
path: root/Doc/library/urllib.parse.rst
diff options
context:
space:
mode:
authorFacundo Batista <facundobatista@gmail.com>2008-09-03 22:49:01 (GMT)
committerFacundo Batista <facundobatista@gmail.com>2008-09-03 22:49:01 (GMT)
commitc469d4c3aa0a66579d1927f0e5d9630b3ea4024f (patch)
tree991fd708a1cad2f61d7ef86eceda43906c06d8de /Doc/library/urllib.parse.rst
parent849f79a5d63deff924e1c62385af0441ee099bcf (diff)
downloadcpython-c469d4c3aa0a66579d1927f0e5d9630b3ea4024f.zip
cpython-c469d4c3aa0a66579d1927f0e5d9630b3ea4024f.tar.gz
cpython-c469d4c3aa0a66579d1927f0e5d9630b3ea4024f.tar.bz2
Issue 600362: Relocated parse_qs() and parse_qsl(), from the cgi module
to the urlparse one. Added a DeprecationWarning in the old module, it will be deprecated in the future. Docs and tests updated.
Diffstat (limited to 'Doc/library/urllib.parse.rst')
-rw-r--r--Doc/library/urllib.parse.rst43
1 files changed, 42 insertions, 1 deletions
diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst
index 0848857..26376e7 100644
--- a/Doc/library/urllib.parse.rst
+++ b/Doc/library/urllib.parse.rst
@@ -89,6 +89,47 @@ The :mod:`urllib.parse` module defines the following functions:
object.
+.. function:: parse_qs(qs[, keep_blank_values[, strict_parsing]])
+
+ Parse a query string given as a string argument (data of type
+ :mimetype:`application/x-www-form-urlencoded`). Data are returned as a
+ dictionary. The dictionary keys are the unique query variable names and the
+ values are lists of values for each name.
+
+ The optional argument *keep_blank_values* is a flag indicating whether blank
+ values in URL 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.
+
+ The optional argument *strict_parsing* is a flag indicating what to do with
+ parsing errors. If false (the default), errors are silently ignored. If true,
+ errors raise a :exc:`ValueError` exception.
+
+ Use the :func:`urllib.urlencode` function to convert such dictionaries into
+ query strings.
+
+
+.. function:: parse_qsl(qs[, keep_blank_values[, strict_parsing]])
+
+ 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
+ name, value pairs.
+
+ The optional argument *keep_blank_values* is a flag indicating whether blank
+ values in URL 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.
+
+ The optional argument *strict_parsing* is a flag indicating what to do with
+ parsing errors. If false (the default), errors are silently ignored. If true,
+ errors raise a :exc:`ValueError` exception.
+
+ Use the :func:`urllib.parse.urlencode` function to convert such lists of pairs into
+ query strings.
+
+
.. function:: urlunparse(parts)
Construct a URL from a tuple as returned by ``urlparse()``. The *parts*
@@ -273,7 +314,7 @@ The :mod:`urllib.parse` module defines the following functions:
of the sequence. When a sequence of two-element tuples is used as the *query*
argument, the first element of each tuple is a key and the second is a value.
The order of parameters in the encoded string will match the order of parameter
- tuples in the sequence. The :mod:`cgi` module provides the functions
+ tuples in the sequence. This module provides the functions
:func:`parse_qs` and :func:`parse_qsl` which are used to parse query strings
into Python data structures.