mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Fixed typos and bug in the second example, reported by Scott Schram
<schram@users.sourceforge.net>. This closes bug #122236.
This commit is contained in:
parent
4526f2a230
commit
d99e534de6
1 changed files with 3 additions and 2 deletions
|
@ -137,12 +137,13 @@ Here is an example session that shows how to \samp{POST} requests:
|
|||
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
|
||||
>>> h = httplib.HTTP("www.musi-cal.com:80")
|
||||
>>> h.putrequest("POST", "/cgi-bin/query")
|
||||
>>> h.putheader("Content-type", "application/x-www-form-urlencoded")
|
||||
>>> h.putheader("Content-length", "%d" % len(params))
|
||||
>>> h.putheader('Accept', 'text/plain')
|
||||
>>> h.putheader('Host', 'www.musi-cal.com')
|
||||
>>> h.endheaders()
|
||||
>>> h.send(paramstring)
|
||||
>>> h.send(params)
|
||||
>>> reply, msg, hdrs = h.getreply()
|
||||
>>> print errcode # should be 200
|
||||
>>> print reply # should be 200
|
||||
>>> data = h.getfile().read() # get the raw HTML
|
||||
\end{verbatim}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue