httplib2 / index.html

     <!--#include virtual="header.html" -->
    <title>Joe Gregorio | BitWorking | Projects |</title>
<body class='main' id="top" name="top" >
    <div class="body">
        <!--#include virtual="titlebar.html" -->

        <div class="content">

                <p>A comprehensive HTTP client library, <code></code> 
                supports many features left out of other HTTP libraries.
                    <dt>HTTP and HTTPS</dt>
                    <dd>HTTPS support is only available if the socket module was compiled with SSL support.

                    <dd>Supports HTTP 1.1 Keep-Alive, keeping the socket 
                    open and performing multiple requests over the same connection
                    if possible.

                    <dd>The following types of HTTP Authentication are supported. 
                    These can be used over both HTTP and HTTPS.
                        <li><a href="">Digest</a></li>
                        <li><a href="">Basic</a></li>
                        <li><a href="">WSSE</a></li>
                        <li><a href="">HMAC Digest</a></li>
                        <li><a href="">Google Account Authentication</a></li>

                    <dd>The module can optionally operate with a private
                    cache that understands the Cache-Control: header and
                    uses both the ETag and Last-Modified cache validators.

                    <dt>All Methods</dt>
                    <dd>The module can handle any HTTP request method, not just GET and POST.</dd>

                    <dd>Automatically follows 3XX redirects on GETs.</dd>

                    <dd>Handles both 'deflate' and 'gzip' types of compression.</dd>

                    <dt>Lost update support</dt>
                    <dd>Automatically adds back ETags into PUT requests to resources
                    we have already cached. This implements Section 3.2 of 
                    <a href="">Detecting the Lost Update Problem Using Unreserved Checkout</a></dd>

                    <dt>Unit Tested</dt>
                    <dd>A large and growing set of unit tests.</dd>



<p>A simple retrieval:</p>

<pre><code>import httplib2
h = httplib2.Http(".cache")
resp, content = h.request("", "GET")

<p>The 'content' is the content retrieved from the URL.
The content is already decompressed or unzipped if necessary.
The 'resp' contains all the response headers.

<p>To PUT some content to a server that uses SSL
and Basic authentication:</p>

<pre><code>import httplib2
h = httplib2.Http(".cache")
h.add_credentials('name', 'password')
resp, content = h.request("", 
    "PUT", body="This is text", 
    headers={'content-type':'text/plain'} )

<p>Use the Cache-Control: header to control
   how the caching operates.</p>

<pre><code>import httplib2
h = httplib2.Http(".cache")
resp, content = h.request("")
resp, content = h.request("", 

<p>The first request will be cached and since this is a request to it will be set to be cached for two hours, because
that is how I have my server configured.
Any subsequent GET to that URI will return the value from the
on-disk cache and no request will be made to the server.
You can use the Cache-Control: header to change the caches behavior and
in this example the second request adds the Cache-Control: header with a value
of 'no-cache' which tells the library that the cached copy
must not be used when handling this request.


<p>Requires Python 2.3 or later. Does not require
any libraries beyond what is found in the core library.</p>


<p>The latest release of httplib2 is 0.3.0 and 
can be <a href="dist">downloaded from the from 
    the dist directory</a>. See the
<a href="CHANGELOG">CHANGELOG</a> for what's new in this

<p>The httplib2 module is shipped as a distutils package.  To install
the library, first unpack the distribution archive, and issue the following

<pre><code>$ python install</code></pre>

<p><a href="dist">Download the distribution archives from here</a>. </p>

<p> <a href="test">The resources used in the unit test cases</a>
  are available also. More documentation on them will be forthcoming.</p>

<p>You can also get the sources directly from the SourceForge hosted
  subversion repository.</p>

<pre>svn co httplib2</pre>


<p>In addition to the <a href="ref/">Python library style documentation</a> there
are also two articles on, <a href="">
    Doing HTTP Caching Right: Introducing httplib2</a> and 
<a href="">
httplib2: HTTP Persistence and Authentication </a>.



<p>Bugs and enhancement requests are handled through  
<a href="">SourceForge</a>, and anything is up for discussion
on the <a href="">httplib2 mailing list</a>.

<h3>To Do</h3>

<p>This module is not perfect and needs the following:</p>
    <li>Support for Proxies</li>
    <li>A pluggable store for the cache is in place, with plugins for 
    flat files and memcached. 
    I eventually want to have plugins that allow keeping the cache in Berkeley DB, MySQL, etc.</li>
    <li>More unit tests</li>

<h3>Project Goal</h3>

<p>To become a worthy addition to the Python core library.</p>

<h3>Additional Information</h3>

       <dd>Joe Gregorio</dd>



       <dd> Thomas Broyer ( </dd>
       <dd> James Antill </dd>
       <dd> Xavier Verges Farrero </dd>
       <dd> Jonathan Feinberg </dd>
       <dd> Blair Zajac </dd>
       <dd> Sam Ruby</dd>
       <dd> Louis Nyffenegger </dd>
       <dd> (Your Name Here) </dd>
  <p style="font-size: small">This page last updated on: $LastChangedDate$.</p>

     <!--#include virtual="footer.html" -->