changeset: 71437:bc71fff2b6c7 parent: 71435:6f9d917df541 parent: 71436:ab4d403cb0c0 user: Senthil Kumaran date: Wed Jul 20 21:57:07 2011 +0800 description: merge from 3.2 - Fix closes issue12524 - update http.client POST example with a working example. diff -r 6f9d917df541 -r bc71fff2b6c7 Doc/library/http.client.rst --- a/Doc/library/http.client.rst Wed Jul 20 02:01:39 2011 +0200 +++ b/Doc/library/http.client.rst Wed Jul 20 21:57:07 2011 +0800 @@ -592,15 +592,17 @@ 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 http://bugs.python.org/issue12524' >>> conn.close()

AltStyle によって変換されたページ (->オリジナル) /