]> granicus.if.org Git - python/commitdiff
merge from 3.2 - Fix closes issue12524 - update http.client POST example with a worki...
authorSenthil Kumaran <senthil@uthcode.com>
Wed, 20 Jul 2011 14:02:27 +0000 (22:02 +0800)
committerSenthil Kumaran <senthil@uthcode.com>
Wed, 20 Jul 2011 14:02:27 +0000 (22:02 +0800)
Doc/library/httplib.rst

index 436857c9601dca0323e3dff38610e9b4d307f0df..2789c081655d636a6f459143f72ba9169338f7e5 100644 (file)
@@ -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()