summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2010-12-19 10:49:52 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2010-12-19 10:49:52 (GMT)
commit7bc0d872ddb023333acc05b7d038cdb74cfc047b (patch)
tree6225e5ecb0546a7826743510555c604751b238c7 /Doc/library
parent8a60e94802b04a838607b4aebba6fc8b70f7b87c (diff)
downloadcpython-7bc0d872ddb023333acc05b7d038cdb74cfc047b.zip
cpython-7bc0d872ddb023333acc05b7d038cdb74cfc047b.tar.gz
cpython-7bc0d872ddb023333acc05b7d038cdb74cfc047b.tar.bz2
Issue3243 - Support iterable bodies in httplib. Patch contributions by Xuanji Li and Chris AtLee.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/http.client.rst12
-rw-r--r--Doc/library/urllib.request.rst16
2 files changed, 18 insertions, 10 deletions
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
index 67d7271..cba5907 100644
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -393,14 +393,18 @@ HTTPConnection Objects
string.
The *body* may also be an open :term:`file object`, in which case the
- contents of the file is sent; this file object should support
- ``fileno()`` and ``read()`` methods. The header Content-Length is
- automatically set to the length of the file as reported by
- stat.
+ contents of the file is sent; this file object should support ``fileno()``
+ and ``read()`` methods. The header Content-Length is automatically set to
+ the length of the file as reported by stat. The *body* argument may also be
+ an iterable and Contet-Length header should be explicitly provided when the
+ body is an iterable.
The *headers* argument should be a mapping of extra HTTP
headers to send with the request.
+ .. versionadded:: 3.2
+ *body* can be an iterable
+
.. method:: HTTPConnection.getresponse()
Should be called after a request is sent to get the response from the server.
diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst
index 730d258..6aa9e15 100644
--- a/Doc/library/urllib.request.rst
+++ b/Doc/library/urllib.request.rst
@@ -21,13 +21,14 @@ The :mod:`urllib.request` module defines the following functions:
:class:`Request` object.
*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*; 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
+ server, or ``None`` if no such data is needed. *data* may also be an
+ iterable object and in that case Content-Length value must be specified in
+ the headers. 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. urllib.request module uses
+ :func:`urllib.parse.urlencode` function takes a mapping or sequence of
+ 2-tuples and returns a string in this format. urllib.request module uses
HTTP/1.1 and includes ``Connection:close`` header in its HTTP requests.
The optional *timeout* parameter specifies a timeout in seconds for
@@ -76,6 +77,9 @@ The :mod:`urllib.request` module defines the following functions:
HTTPS virtual hosts are now supported if possible (that is, if
:data:`ssl.HAS_SNI` is true).
+ .. versionadded:: 3.2
+ *data* can be an iterable object.
+
.. function:: install_opener(opener)
Install an :class:`OpenerDirector` instance as the default global opener.