diff options
| author | jcgregorio <devnull@localhost> | 2007-03-08 21:59:04 +0000 |
|---|---|---|
| committer | jcgregorio <devnull@localhost> | 2007-03-08 21:59:04 +0000 |
| commit | cde4f09e150ba2dab89e190bc3dbed7d3ca7bbfb (patch) | |
| tree | 7ec88f9706e13cf0bf27adc26c0c075ed6e40c20 /ref/httplib2-example.html | |
| parent | 07a9a4aa4cb78ad716d55db5beffd7f2dbe1cbcc (diff) | |
| download | httplib2-cde4f09e150ba2dab89e190bc3dbed7d3ca7bbfb.tar.gz | |
Documented changes in fixing bug 1597381 Map exceptions to status codes
Diffstat (limited to 'ref/httplib2-example.html')
| -rw-r--r-- | ref/httplib2-example.html | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/ref/httplib2-example.html b/ref/httplib2-example.html index 6e6e5c0..1b245a1 100644 --- a/ref/httplib2-example.html +++ b/ref/httplib2-example.html @@ -106,6 +106,22 @@ resp, content = h.request(uri, "POST", body=body, headers=headers) </pre></div> <P> +Here is an example of providing data to an HTML form processor. +In this case we presume this is a POST form. We need to take our +data and format it as "application/x-www-form-urlencoded" data and use that as a +body for a POST request. + +<P> +<div class="verbatim"><pre> +>>> import httplib2 +>>> import urllib +>>> data = {'name': 'fred', 'address': '123 shady lane'} +>>> body = urllib.urlencode(data) +>>> body +'name=fred&address=123+shady+lane' +>>> h = httplib2.Http() +>>> resp, content = h.request("http://example.com", method="POST", body=body) +</pre></div> <P> <IMG @@ -150,7 +166,7 @@ resp, content = h.request(uri, "POST", body=body, headers=headers) </div> </div> <hr /> -<span class="release-info">Release 0.2, documentation updated on July 2, 2006.</span> +<span class="release-info">Release 0.3, documentation updated on Mar 8, 2007.</span> </DIV> <!--End of Navigation Panel--> |
