summaryrefslogtreecommitdiff
path: root/Doc/library/httplib.rst
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2011-07-20 22:02:27 +0800
committerSenthil Kumaran <senthil@uthcode.com>2011-07-20 22:02:27 +0800
commitcd57ef1a472b581a137947de1d5e665182e15410 (patch)
tree0d85b30231f29b057f83d7c9cda237c88806d501 /Doc/library/httplib.rst
parenta4c383b8b3d8587d16229610dde51e0949264e38 (diff)
downloadcpython-git-cd57ef1a472b581a137947de1d5e665182e15410.tar.gz
merge from 3.2 - Fix closes issue12524 - update http.client POST example with a working example. - Patch contributed by Bharadwaj
Diffstat (limited to 'Doc/library/httplib.rst')
-rw-r--r--Doc/library/httplib.rst10
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/library/httplib.rst b/Doc/library/httplib.rst
index 436857c960..2789c08165 100644
--- a/Doc/library/httplib.rst
+++ b/Doc/library/httplib.rst
@@ -588,14 +588,16 @@ 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 httplib, urllib
- >>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
+ >>> params = urllib.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'})
>>> headers = {"Content-type": "application/x-www-form-urlencoded",
... "Accept": "text/plain"}
- >>> conn = httplib.HTTPConnection("musi-cal.mojam.com:80")
- >>> conn.request("POST", "/cgi-bin/query", params, headers)
+ >>> conn = httplib.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
+ 'Redirecting to <a href="http://bugs.python.org/issue12524">http://bugs.python.org/issue12524</a>'
>>> conn.close()