From: Senthil Kumaran Date: Thu, 15 Mar 2012 01:11:46 +0000 (-0700) Subject: cpython:Fix the wrong urllib exampls which use str for POST data. Closes Issue11261 X-Git-Tag: v3.3.0a2~180^2^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7596aeaba7944fd8615b061c578a8ff284b40698;p=thirdparty%2FPython%2Fcpython.git cpython:Fix the wrong urllib exampls which use str for POST data. Closes Issue11261 --- 7596aeaba7944fd8615b061c578a8ff284b40698 diff --cc Doc/library/urllib.request.rst index ef5d2daf6fa2,24e24443ab23..0bcd0bca5558 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@@ -1174,16 -1120,9 +1173,16 @@@ some point in the future third argument may be ``-1`` on older FTP servers which do not return a file size in response to a retrieval request. + The following example illustrates the most common usage scenario:: + + >>> import urllib.request + >>> local_filename, headers = urllib.request.urlretrieve('http://python.org/') + >>> html = open(local_filename) + >>> html.close() + If the *url* uses the :file:`http:` scheme identifier, the optional *data* argument may be given to specify a ``POST`` request (normally the request - type is ``GET``). The *data* argument must in standard + type is ``GET``). The *data* argument must be a bytes object in standard :mimetype:`application/x-www-form-urlencoded` format; see the :func:`urlencode` function below.