diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-03-15 01:11:46 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-03-15 01:11:46 (GMT) |
commit | 7596aeaba7944fd8615b061c578a8ff284b40698 (patch) | |
tree | 7aa65d33053679c0d6b45db832ce34de7633dfa0 /Doc/library/urllib.request.rst | |
parent | 3d7c878fe370e59b142bac9bc32c67b4ac9d949e (diff) | |
parent | 87684e6eeab154bf7d8775b767e2558ddf659745 (diff) | |
download | cpython-7596aeaba7944fd8615b061c578a8ff284b40698.zip cpython-7596aeaba7944fd8615b061c578a8ff284b40698.tar.gz cpython-7596aeaba7944fd8615b061c578a8ff284b40698.tar.bz2 |
cpython:Fix the wrong urllib exampls which use str for POST data. Closes Issue11261
Diffstat (limited to 'Doc/library/urllib.request.rst')
-rw-r--r-- | Doc/library/urllib.request.rst | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index ef5d2da..0bcd0bc 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -138,14 +138,13 @@ The following classes are provided: *url* should be a string containing a valid URL. - *data* may be a string specifying additional data to send to the - server, or ``None`` if no such data is needed. Currently HTTP - requests are the only ones that use *data*, in order to choose between - ``'GET'`` and ``'POST'`` when *method* is not specified. - *data* should be a buffer in the standard - :mimetype:`application/x-www-form-urlencoded` format. The - :func:`urllib.parse.urlencode` function takes a mapping or sequence - of 2-tuples and returns a string in this format. + *data* may be a bytes object specifying additional data to send to the + server, or ``None`` if no such data is needed. Currently HTTP requests are + the only ones that use *data*; the HTTP request will be a POST instead of a + GET when the *data* parameter is provided. *data* should be a buffer in the + standard :mimetype:`application/x-www-form-urlencoded` format. The + :func:`urllib.parse.urlencode` function takes a mapping or sequence of + 2-tuples and returns a string in this format. *headers* should be a dictionary, and will be treated as if :meth:`add_header` was called with each key and value as arguments. @@ -1183,7 +1182,7 @@ some point in the future. 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. |