diff options
author | Skip Montanaro <skip@pobox.com> | 2001-01-28 21:18:16 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2001-01-28 21:18:16 (GMT) |
commit | 4fda21ba6b7627eef00588fac8f12395b96107af (patch) | |
tree | c019815aa6da2c811e573282e80d64cb57b2c4a6 /Doc/lib/liburllib.tex | |
parent | 080c99745f9c5791284f8cfa2768f220a63b4807 (diff) | |
download | cpython-4fda21ba6b7627eef00588fac8f12395b96107af.zip cpython-4fda21ba6b7627eef00588fac8f12395b96107af.tar.gz cpython-4fda21ba6b7627eef00588fac8f12395b96107af.tar.bz2 |
updated to document use of sequences of two-element tuples as inputs
Diffstat (limited to 'Doc/lib/liburllib.tex')
-rw-r--r-- | Doc/lib/liburllib.tex | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Doc/lib/liburllib.tex b/Doc/lib/liburllib.tex index efceb8a..1c43b47 100644 --- a/Doc/lib/liburllib.tex +++ b/Doc/lib/liburllib.tex @@ -143,8 +143,9 @@ Like \function{unquote()}, but also replaces plus signs by spaces, as required for unquoting HTML form values. \end{funcdesc} -\begin{funcdesc}{urlencode}{dict\optional{, doseq}} -Convert a dictionary to a ``url-encoded'' string, suitable to pass to +\begin{funcdesc}{urlencode}{query\optional{, doseq}} +Convert a mapping object or a sequence of two-element tuples to a +``url-encoded'' string, suitable to pass to \function{urlopen()} above as the optional \var{data} argument. This is useful to pass a dictionary of form fields to a \code{POST} request. The resulting string is a series of @@ -153,6 +154,10 @@ characters, where both \var{key} and \var{value} are quoted using \function{quote_plus()} above. If the optional parameter \var{doseq} is present and evaluates to true, individual \code{\var{key}=\var{value}} pairs are generated for each element of the sequence. +When a sequence of two-element tuples is used as the \var{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. \end{funcdesc} The public functions \function{urlopen()} and |