~ubuntu-branches/ubuntu/natty/python2.6/natty-security

« back to all changes in this revision

Viewing changes to Doc/library/urllib.rst

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-06-24 00:31:14 UTC
  • mfrom: (10.1.18 sid)
  • Revision ID: james.westby@ubuntu.com-20100624003114-jmwmbudlpucl6ip3
Tags: 2.6.5+20100616-1ubuntu1
* Merge from Debian Unstable.  Remaining Ubuntu changes:
  - Add new symbols to libpython.symbols.in
  - Re-enable the profiled build on all architectures
  - Priority for python2.6-minimal is required instead of optional
  - python2.6-minimal and python2.6 Conflict python-central
    (<< 0.6.11ubuntu6)

Show diffs side-by-side

added added

removed removed

Lines of Context:
236
236
 
237
237
.. function:: urlencode(query[, doseq])
238
238
 
239
 
   Convert a mapping object or a sequence of two-element tuples  to a "url-encoded"
240
 
   string, suitable to pass to :func:`urlopen` above as the optional *data*
241
 
   argument.  This is useful to pass a dictionary of form fields to a ``POST``
242
 
   request.  The resulting string is a series of ``key=value`` pairs separated by
243
 
   ``'&'`` characters, where both *key* and *value* are quoted using
244
 
   :func:`quote_plus` above.  If the optional parameter *doseq* is present and
245
 
   evaluates to true, individual ``key=value`` pairs are generated for each element
246
 
   of the sequence. When a sequence of two-element tuples is used as the *query*
247
 
   argument, the first element of each tuple is a key and the second is a value.
248
 
   The order of parameters in the encoded string will match the order of parameter
249
 
   tuples in the sequence. The :mod:`urlparse` module provides the functions
 
239
   Convert a mapping object or a sequence of two-element tuples  to a
 
240
   "url-encoded" string, suitable to pass to :func:`urlopen` above as the
 
241
   optional *data* argument.  This is useful to pass a dictionary of form
 
242
   fields to a ``POST`` request.  The resulting string is a series of
 
243
   ``key=value`` pairs separated by ``'&'`` characters, where both *key* and
 
244
   *value* are quoted using :func:`quote_plus` above.  When a sequence of
 
245
   two-element tuples is used as the *query* argument, the first element of
 
246
   each tuple is a key and the second is a value. The value element in itself
 
247
   can be a sequence and in that case, if the optional parameter *doseq* is
 
248
   evaluates to *True*, individual ``key=value`` pairs separated by ``'&'``are
 
249
   generated for each element of the value sequence for the key.  The order of
 
250
   parameters in the encoded string will match the order of parameter tuples in
 
251
   the sequence. The :mod:`urlparse` module provides the functions
250
252
   :func:`parse_qs` and :func:`parse_qsl` which are used to parse query strings
251
253
   into Python data structures.
252
254