summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2011-07-20 13:57:07 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2011-07-20 13:57:07 (GMT)
commit3e44612726ff8be8b7b43aa9043441206a35a08f (patch)
tree911f13003388c5002a6545c4653dc2b885e6564d
parentfb96089b136d498f2515c91fb1dac2a8a8a00482 (diff)
parent96c84a4c7d7001af8ac8a38fa7304db669728a51 (diff)
downloadcpython-3e44612726ff8be8b7b43aa9043441206a35a08f.zip
cpython-3e44612726ff8be8b7b43aa9043441206a35a08f.tar.gz
cpython-3e44612726ff8be8b7b43aa9043441206a35a08f.tar.bz2
merge from 3.2 - Fix closes issue12524 - update http.client POST example with a working example.
-rw-r--r--Doc/library/http.client.rst10
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
index 54873ae..3749ff2 100644
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -592,15 +592,17 @@ Here is an example session that uses the ``HEAD`` method. Note that the
Here is an example session that shows how to ``POST`` requests::
>>> import http.client, urllib.parse
- >>> params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
+ >>> params = urllib.parse.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'})
>>> headers = {"Content-type": "application/x-www-form-urlencoded",
... "Accept": "text/plain"}
- >>> conn = http.client.HTTPConnection("musi-cal.mojam.com:80")
- >>> conn.request("POST", "/cgi-bin/query", params, headers)
+ >>> conn = http.client.HTTPConnection("bugs.python.org")
+ >>> conn.request("POST", "", params, headers)
>>> response = conn.getresponse()
>>> print(response.status, response.reason)
- 200 OK
+ 302 Found
>>> data = response.read()
+ >>> data
+ b'Redirecting to <a href="http://bugs.python.org/issue12524">http://bugs.python.org/issue12524</a>'
>>> conn.close()