diff options
Diffstat (limited to 'ref/httplib2-example.html')
-rw-r--r--[-rwxr-xr-x] | ref/httplib2-example.html | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ref/httplib2-example.html b/ref/httplib2-example.html index 756942b..6607efe 100755..100644 --- a/ref/httplib2-example.html +++ b/ref/httplib2-example.html @@ -50,7 +50,7 @@ <h2><a name="SECTION002140000000000000000"></a><a name="httplib2-example"></a> <br> -1.1.4 Examples +1.1.4 Examples </h2> <p> @@ -67,23 +67,23 @@ assert resp['content-type'] == 'text/html' </pre></div> <p> -Here is more complex example that does a PUT +Here is more complex example that does a PUT of some text to a resource that requires authentication. The Http instance also uses a file cache -in the directory <code>.cache</code>. +in the directory <code>.cache</code>. <p> <div class="verbatim"><pre> import httplib2 h = httplib2.Http(".cache") h.add_credentials('name', 'password') -resp, content = h.request("https://example.org/chap/2", - "PUT", body="This is text", +resp, content = h.request("https://example.org/chap/2", + "PUT", body="This is text", headers={'content-type':'text/plain'} ) </pre></div> <p> -Here is an example that connects to a server that +Here is an example that connects to a server that supports the Atom Publishing Protocol. <p> @@ -108,8 +108,8 @@ resp, content = h.request(uri, "POST", body=body, headers=headers) <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 +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> @@ -142,9 +142,9 @@ r,c = h.request("http://bitworking.org/news/") WIDTH="556" HEIGHT="20" ALIGN="BOTTOM" BORDER="0" SRC="img1.png" ALT="\begin{center}\vbox{\input{modref.ind} -}\end{center}"> +}\end{center}"> <p> - + <p> <div class="navigation"> |