Updated docs
diff --git a/apiclient/http.py b/apiclient/http.py
index 21455f9..86d6663 100644
--- a/apiclient/http.py
+++ b/apiclient/http.py
@@ -20,10 +20,6 @@
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
-__all__ = [
- 'HttpRequest', 'RequestMockBuilder', 'HttpMock'
- 'set_user_agent', 'tunnel_patch'
- ]
import StringIO
import base64
diff --git a/docs/apiclient.http.html b/docs/apiclient.http.html
index bfdde06..b4c2cc8 100644
--- a/docs/apiclient.http.html
+++ b/docs/apiclient.http.html
@@ -44,7 +44,19 @@
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
-<dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpRequest">HttpRequest</a>
+<dt><font face="helvetica, arial"><a href="apiclient.http.html#BatchHttpRequest">BatchHttpRequest</a>
+</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpMock">HttpMock</a>
+</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpMockSequence">HttpMockSequence</a>
+</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpRequest">HttpRequest</a>
+</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#HttpRequestMock">HttpRequestMock</a>
+</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#MediaUpload">MediaUpload</a>
+</font></dt><dd>
+<dl>
+<dt><font face="helvetica, arial"><a href="apiclient.http.html#MediaFileUpload">MediaFileUpload</a>
+</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#MediaInMemoryUpload">MediaInMemoryUpload</a>
+</font></dt></dl>
+</dd>
+<dt><font face="helvetica, arial"><a href="apiclient.http.html#MediaUploadProgress">MediaUploadProgress</a>
</font></dt><dt><font face="helvetica, arial"><a href="apiclient.http.html#RequestMockBuilder">RequestMockBuilder</a>
</font></dt></dl>
</dd>
@@ -53,6 +65,138 @@
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
+<font color="#000000" face="helvetica, arial"><a name="BatchHttpRequest">class <strong>BatchHttpRequest</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
+
+<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
+<td colspan=2><tt>Batches multiple <a href="#HttpRequest">HttpRequest</a> objects into a single HTTP request.<br> </tt></td></tr>
+<tr><td> </td>
+<td width="100%">Methods defined here:<br>
+<dl><dt><a name="BatchHttpRequest-__init__"><strong>__init__</strong></a>(self, callback<font color="#909090">=None</font>, batch_uri<font color="#909090">=None</font>)</dt><dd><tt>Constructor for a <a href="#BatchHttpRequest">BatchHttpRequest</a>.<br>
+ <br>
+Args:<br>
+ callback: callable, A callback to be called for each response, of the<br>
+ form callback(id, response). The first parameter is the request id, and<br>
+ the second is the deserialized response <a href="__builtin__.html#object">object</a>.<br>
+ batch_uri: string, URI to send batch requests to.</tt></dd></dl>
+
+<dl><dt><a name="BatchHttpRequest-add"><strong>add</strong></a>(self, request, callback<font color="#909090">=None</font>, request_id<font color="#909090">=None</font>)</dt><dd><tt>Add a new request.<br>
+ <br>
+Every callback added will be paired with a unique id, the request_id. That<br>
+unique id will be passed back to the callback when the response comes back<br>
+from the server. The default behavior is to have the library generate it's<br>
+own unique id. If the caller passes in a request_id then they must ensure<br>
+uniqueness for each request_id, and if they are not an exception is<br>
+raised. Callers should either supply all request_ids or nevery supply a<br>
+request id, to avoid such an error.<br>
+ <br>
+Args:<br>
+ request: <a href="#HttpRequest">HttpRequest</a>, Request to add to the batch.<br>
+ callback: callable, A callback to be called for this response, of the<br>
+ form callback(id, response). The first parameter is the request id, and<br>
+ the second is the deserialized response <a href="__builtin__.html#object">object</a>.<br>
+ request_id: string, A unique id for the request. The id will be passed to<br>
+ the callback with the response.<br>
+ <br>
+Returns:<br>
+ None<br>
+ <br>
+Raises:<br>
+ BatchError if a resumable request is added to a batch.<br>
+ KeyError is the request_id is not unique.</tt></dd></dl>
+
+<dl><dt><a name="BatchHttpRequest-execute"><strong>execute</strong></a>(self, http<font color="#909090">=None</font>)</dt><dd><tt>Execute all the requests as a single batched HTTP request.<br>
+ <br>
+Args:<br>
+ http: httplib2.Http, an http <a href="__builtin__.html#object">object</a> to be used in place of the one the<br>
+ <a href="#HttpRequest">HttpRequest</a> request <a href="__builtin__.html#object">object</a> was constructed with. If one isn't supplied<br>
+ then use a http <a href="__builtin__.html#object">object</a> from the requests in this batch.<br>
+ <br>
+Returns:<br>
+ None<br>
+ <br>
+Raises:<br>
+ httplib2.Error if a transport error has occured.<br>
+ apiclient.errors.BatchError if the response is the wrong format.</tt></dd></dl>
+
+<hr>
+Data descriptors defined here:<br>
+<dl><dt><strong>__dict__</strong></dt>
+<dd><tt>dictionary for instance variables (if defined)</tt></dd>
+</dl>
+<dl><dt><strong>__weakref__</strong></dt>
+<dd><tt>list of weak references to the object (if defined)</tt></dd>
+</dl>
+</td></tr></table> <p>
+<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
+<tr bgcolor="#ffc8d8">
+<td colspan=3 valign=bottom> <br>
+<font color="#000000" face="helvetica, arial"><a name="HttpMock">class <strong>HttpMock</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
+
+<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
+<td colspan=2><tt>Mock of httplib2.Http<br> </tt></td></tr>
+<tr><td> </td>
+<td width="100%">Methods defined here:<br>
+<dl><dt><a name="HttpMock-__init__"><strong>__init__</strong></a>(self, filename, headers<font color="#909090">=None</font>)</dt><dd><tt>Args:<br>
+ filename: string, absolute filename to read response from<br>
+ headers: dict, header to return with response</tt></dd></dl>
+
+<dl><dt><a name="HttpMock-request"><strong>request</strong></a>(self, uri, method<font color="#909090">='GET'</font>, body<font color="#909090">=None</font>, headers<font color="#909090">=None</font>, redirections<font color="#909090">=1</font>, connection_type<font color="#909090">=None</font>)</dt></dl>
+
+<hr>
+Data descriptors defined here:<br>
+<dl><dt><strong>__dict__</strong></dt>
+<dd><tt>dictionary for instance variables (if defined)</tt></dd>
+</dl>
+<dl><dt><strong>__weakref__</strong></dt>
+<dd><tt>list of weak references to the object (if defined)</tt></dd>
+</dl>
+</td></tr></table> <p>
+<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
+<tr bgcolor="#ffc8d8">
+<td colspan=3 valign=bottom> <br>
+<font color="#000000" face="helvetica, arial"><a name="HttpMockSequence">class <strong>HttpMockSequence</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
+
+<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
+<td colspan=2><tt>Mock of httplib2.Http<br>
+ <br>
+Mocks a sequence of calls to request returning different responses for each<br>
+call. Create an instance initialized with the desired response headers<br>
+and content and then use as if an httplib2.Http instance.<br>
+ <br>
+ http = <a href="#HttpMockSequence">HttpMockSequence</a>([<br>
+ ({'status': '401'}, ''),<br>
+ ({'status': '200'}, '{"access_token":"1/3w","expires_in":3600}'),<br>
+ ({'status': '200'}, 'echo_request_headers'),<br>
+ ])<br>
+ resp, content = http.<a href="#HttpMockSequence-request">request</a>("<a href="http://examples.com">http://examples.com</a>")<br>
+ <br>
+There are special values you can pass in for content to trigger<br>
+behavours that are helpful in testing.<br>
+ <br>
+'echo_request_headers' means return the request headers in the response body<br>
+'echo_request_headers_as_json' means return the request headers in<br>
+ the response body<br>
+'echo_request_body' means return the request body in the response body<br>
+'echo_request_uri' means return the request uri in the response body<br> </tt></td></tr>
+<tr><td> </td>
+<td width="100%">Methods defined here:<br>
+<dl><dt><a name="HttpMockSequence-__init__"><strong>__init__</strong></a>(self, iterable)</dt><dd><tt>Args:<br>
+ iterable: iterable, a sequence of pairs of (headers, body)</tt></dd></dl>
+
+<dl><dt><a name="HttpMockSequence-request"><strong>request</strong></a>(self, uri, method<font color="#909090">='GET'</font>, body<font color="#909090">=None</font>, headers<font color="#909090">=None</font>, redirections<font color="#909090">=1</font>, connection_type<font color="#909090">=None</font>)</dt></dl>
+
+<hr>
+Data descriptors defined here:<br>
+<dl><dt><strong>__dict__</strong></dt>
+<dd><tt>dictionary for instance variables (if defined)</tt></dd>
+</dl>
+<dl><dt><strong>__weakref__</strong></dt>
+<dd><tt>list of weak references to the object (if defined)</tt></dd>
+</dl>
+</td></tr></table> <p>
+<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
+<tr bgcolor="#ffc8d8">
+<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="HttpRequest">class <strong>HttpRequest</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
@@ -71,7 +215,7 @@
body: string, the request body of the HTTP request,<br>
headers: dict, the HTTP request headers<br>
methodId: string, a unique identifier for the API method being called.<br>
- resumable: MediaUpload, None if this is not a resumbale request.</tt></dd></dl>
+ resumable: <a href="#MediaUpload">MediaUpload</a>, None if this is not a resumbale request.</tt></dd></dl>
<dl><dt><a name="HttpRequest-execute"><strong>execute</strong></a>(self, http<font color="#909090">=None</font>)</dt><dd><tt>Execute the request.<br>
<br>
@@ -90,11 +234,11 @@
<dl><dt><a name="HttpRequest-next_chunk"><strong>next_chunk</strong></a>(self, http<font color="#909090">=None</font>)</dt><dd><tt>Execute the next step of a resumable upload.<br>
<br>
Can only be used if the method being executed supports media uploads and<br>
-the MediaUpload <a href="__builtin__.html#object">object</a> passed in was flagged as using resumable upload.<br>
+the <a href="#MediaUpload">MediaUpload</a> <a href="__builtin__.html#object">object</a> passed in was flagged as using resumable upload.<br>
<br>
Example:<br>
<br>
- media = MediaFileUpload('smiley.png', mimetype='image/png',<br>
+ media = <a href="#MediaFileUpload">MediaFileUpload</a>('smiley.png', mimetype='image/png',<br>
chunksize=1000, resumable=True)<br>
request = service.objects().insert(<br>
bucket=buckets['items'][0]['id'],<br>
@@ -130,6 +274,289 @@
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
+<font color="#000000" face="helvetica, arial"><a name="HttpRequestMock">class <strong>HttpRequestMock</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
+
+<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
+<td colspan=2><tt>Mock of <a href="#HttpRequest">HttpRequest</a>.<br>
+ <br>
+Do not construct directly, instead use <a href="#RequestMockBuilder">RequestMockBuilder</a>.<br> </tt></td></tr>
+<tr><td> </td>
+<td width="100%">Methods defined here:<br>
+<dl><dt><a name="HttpRequestMock-__init__"><strong>__init__</strong></a>(self, resp, content, postproc)</dt><dd><tt>Constructor for <a href="#HttpRequestMock">HttpRequestMock</a><br>
+ <br>
+Args:<br>
+ resp: httplib2.Response, the response to emulate coming from the request<br>
+ content: string, the response body<br>
+ postproc: callable, the post processing function usually supplied by<br>
+ the model class. See model.JsonModel.response() as an example.</tt></dd></dl>
+
+<dl><dt><a name="HttpRequestMock-execute"><strong>execute</strong></a>(self, http<font color="#909090">=None</font>)</dt><dd><tt>Execute the request.<br>
+ <br>
+Same behavior as <a href="#HttpRequest">HttpRequest</a>.<a href="#HttpRequestMock-execute">execute</a>(), but the response is<br>
+mocked and not really from an HTTP request/response.</tt></dd></dl>
+
+<hr>
+Data descriptors defined here:<br>
+<dl><dt><strong>__dict__</strong></dt>
+<dd><tt>dictionary for instance variables (if defined)</tt></dd>
+</dl>
+<dl><dt><strong>__weakref__</strong></dt>
+<dd><tt>list of weak references to the object (if defined)</tt></dd>
+</dl>
+</td></tr></table> <p>
+<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
+<tr bgcolor="#ffc8d8">
+<td colspan=3 valign=bottom> <br>
+<font color="#000000" face="helvetica, arial"><a name="MediaFileUpload">class <strong>MediaFileUpload</strong></a>(<a href="apiclient.http.html#MediaUpload">MediaUpload</a>)</font></td></tr>
+
+<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
+<td colspan=2><tt>A <a href="#MediaUpload">MediaUpload</a> for a file.<br>
+ <br>
+Construct a <a href="#MediaFileUpload">MediaFileUpload</a> and pass as the media_body parameter of the<br>
+method. For example, if we had a service that allowed uploading images:<br>
+ <br>
+ <br>
+ media = <a href="#MediaFileUpload">MediaFileUpload</a>('smiley.png', mimetype='image/png', chunksize=1000,<br>
+ resumable=True)<br>
+ service.objects().insert(<br>
+ bucket=buckets['items'][0]['id'],<br>
+ name='smiley.png',<br>
+ media_body=media).execute()<br> </tt></td></tr>
+<tr><td> </td>
+<td width="100%"><dl><dt>Method resolution order:</dt>
+<dd><a href="apiclient.http.html#MediaFileUpload">MediaFileUpload</a></dd>
+<dd><a href="apiclient.http.html#MediaUpload">MediaUpload</a></dd>
+<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
+</dl>
+<hr>
+Methods defined here:<br>
+<dl><dt><a name="MediaFileUpload-__init__"><strong>__init__</strong></a>(self, filename, mimetype<font color="#909090">=None</font>, chunksize<font color="#909090">=262144</font>, resumable<font color="#909090">=False</font>)</dt><dd><tt>Constructor.<br>
+ <br>
+Args:<br>
+ filename: string, Name of the file.<br>
+ mimetype: string, Mime-type of the file. If None then a mime-type will be<br>
+ guessed from the file extension.<br>
+ chunksize: int, File will be uploaded in chunks of this many bytes. Only<br>
+ used if resumable=True.<br>
+ resumable: bool, True if this is a resumable upload. False means upload<br>
+ in a single request.</tt></dd></dl>
+
+<dl><dt><a name="MediaFileUpload-chunksize"><strong>chunksize</strong></a>(self)</dt></dl>
+
+<dl><dt><a name="MediaFileUpload-getbytes"><strong>getbytes</strong></a>(self, begin, length)</dt><dd><tt>Get bytes from the media.<br>
+ <br>
+Args:<br>
+ begin: int, offset from beginning of file.<br>
+ length: int, number of bytes to read, starting at begin.<br>
+ <br>
+Returns:<br>
+ A string of bytes read. May be shorted than length if EOF was reached<br>
+ first.</tt></dd></dl>
+
+<dl><dt><a name="MediaFileUpload-mimetype"><strong>mimetype</strong></a>(self)</dt></dl>
+
+<dl><dt><a name="MediaFileUpload-resumable"><strong>resumable</strong></a>(self)</dt></dl>
+
+<dl><dt><a name="MediaFileUpload-size"><strong>size</strong></a>(self)</dt></dl>
+
+<dl><dt><a name="MediaFileUpload-to_json"><strong>to_json</strong></a>(self)</dt><dd><tt>Creating a JSON representation of an instance of Credentials.<br>
+ <br>
+Returns:<br>
+ string, a JSON representation of this instance, suitable to pass to<br>
+ <a href="#MediaFileUpload-from_json">from_json</a>().</tt></dd></dl>
+
+<hr>
+Static methods defined here:<br>
+<dl><dt><a name="MediaFileUpload-from_json"><strong>from_json</strong></a>(s)</dt></dl>
+
+<hr>
+Class methods inherited from <a href="apiclient.http.html#MediaUpload">MediaUpload</a>:<br>
+<dl><dt><a name="MediaFileUpload-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility class method to instantiate a <a href="#MediaUpload">MediaUpload</a> subclass from a JSON<br>
+representation produced by <a href="#MediaFileUpload-to_json">to_json</a>().<br>
+ <br>
+Args:<br>
+ s: string, JSON from <a href="#MediaFileUpload-to_json">to_json</a>().<br>
+ <br>
+Returns:<br>
+ An instance of the subclass of <a href="#MediaUpload">MediaUpload</a> that was serialized with<br>
+ <a href="#MediaFileUpload-to_json">to_json</a>().</tt></dd></dl>
+
+<hr>
+Data descriptors inherited from <a href="apiclient.http.html#MediaUpload">MediaUpload</a>:<br>
+<dl><dt><strong>__dict__</strong></dt>
+<dd><tt>dictionary for instance variables (if defined)</tt></dd>
+</dl>
+<dl><dt><strong>__weakref__</strong></dt>
+<dd><tt>list of weak references to the object (if defined)</tt></dd>
+</dl>
+</td></tr></table> <p>
+<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
+<tr bgcolor="#ffc8d8">
+<td colspan=3 valign=bottom> <br>
+<font color="#000000" face="helvetica, arial"><a name="MediaInMemoryUpload">class <strong>MediaInMemoryUpload</strong></a>(<a href="apiclient.http.html#MediaUpload">MediaUpload</a>)</font></td></tr>
+
+<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
+<td colspan=2><tt><a href="#MediaUpload">MediaUpload</a> for a chunk of bytes.<br>
+ <br>
+Construct a <a href="#MediaFileUpload">MediaFileUpload</a> and pass as the media_body parameter of the<br>
+method. For example, if we had a service that allowed plain text:<br> </tt></td></tr>
+<tr><td> </td>
+<td width="100%"><dl><dt>Method resolution order:</dt>
+<dd><a href="apiclient.http.html#MediaInMemoryUpload">MediaInMemoryUpload</a></dd>
+<dd><a href="apiclient.http.html#MediaUpload">MediaUpload</a></dd>
+<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
+</dl>
+<hr>
+Methods defined here:<br>
+<dl><dt><a name="MediaInMemoryUpload-__init__"><strong>__init__</strong></a>(self, body, mimetype<font color="#909090">='application/octet-stream'</font>, chunksize<font color="#909090">=262144</font>, resumable<font color="#909090">=False</font>)</dt><dd><tt>Create a new MediaBytesUpload.<br>
+ <br>
+Args:<br>
+ body: string, Bytes of body content.<br>
+ mimetype: string, Mime-type of the file or default of<br>
+ 'application/octet-stream'.<br>
+ chunksize: int, File will be uploaded in chunks of this many bytes. Only<br>
+ used if resumable=True.<br>
+ resumable: bool, True if this is a resumable upload. False means upload<br>
+ in a single request.</tt></dd></dl>
+
+<dl><dt><a name="MediaInMemoryUpload-chunksize"><strong>chunksize</strong></a>(self)</dt><dd><tt>Chunk size for resumable uploads.<br>
+ <br>
+Returns:<br>
+ Chunk size in bytes.</tt></dd></dl>
+
+<dl><dt><a name="MediaInMemoryUpload-getbytes"><strong>getbytes</strong></a>(self, begin, length)</dt><dd><tt>Get bytes from the media.<br>
+ <br>
+Args:<br>
+ begin: int, offset from beginning of file.<br>
+ length: int, number of bytes to read, starting at begin.<br>
+ <br>
+Returns:<br>
+ A string of bytes read. May be shorter than length if EOF was reached<br>
+ first.</tt></dd></dl>
+
+<dl><dt><a name="MediaInMemoryUpload-mimetype"><strong>mimetype</strong></a>(self)</dt><dd><tt>Mime type of the body.<br>
+ <br>
+Returns:<br>
+ Mime type.</tt></dd></dl>
+
+<dl><dt><a name="MediaInMemoryUpload-resumable"><strong>resumable</strong></a>(self)</dt><dd><tt>Whether this upload is resumable.<br>
+ <br>
+Returns:<br>
+ True if resumable upload or False.</tt></dd></dl>
+
+<dl><dt><a name="MediaInMemoryUpload-size"><strong>size</strong></a>(self)</dt><dd><tt>Size of upload.<br>
+ <br>
+Returns:<br>
+ Size of the body.</tt></dd></dl>
+
+<dl><dt><a name="MediaInMemoryUpload-to_json"><strong>to_json</strong></a>(self)</dt><dd><tt>Create a JSON representation of a <a href="#MediaInMemoryUpload">MediaInMemoryUpload</a>.<br>
+ <br>
+Returns:<br>
+ string, a JSON representation of this instance, suitable to pass to<br>
+ <a href="#MediaInMemoryUpload-from_json">from_json</a>().</tt></dd></dl>
+
+<hr>
+Static methods defined here:<br>
+<dl><dt><a name="MediaInMemoryUpload-from_json"><strong>from_json</strong></a>(s)</dt></dl>
+
+<hr>
+Class methods inherited from <a href="apiclient.http.html#MediaUpload">MediaUpload</a>:<br>
+<dl><dt><a name="MediaInMemoryUpload-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility class method to instantiate a <a href="#MediaUpload">MediaUpload</a> subclass from a JSON<br>
+representation produced by <a href="#MediaInMemoryUpload-to_json">to_json</a>().<br>
+ <br>
+Args:<br>
+ s: string, JSON from <a href="#MediaInMemoryUpload-to_json">to_json</a>().<br>
+ <br>
+Returns:<br>
+ An instance of the subclass of <a href="#MediaUpload">MediaUpload</a> that was serialized with<br>
+ <a href="#MediaInMemoryUpload-to_json">to_json</a>().</tt></dd></dl>
+
+<hr>
+Data descriptors inherited from <a href="apiclient.http.html#MediaUpload">MediaUpload</a>:<br>
+<dl><dt><strong>__dict__</strong></dt>
+<dd><tt>dictionary for instance variables (if defined)</tt></dd>
+</dl>
+<dl><dt><strong>__weakref__</strong></dt>
+<dd><tt>list of weak references to the object (if defined)</tt></dd>
+</dl>
+</td></tr></table> <p>
+<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
+<tr bgcolor="#ffc8d8">
+<td colspan=3 valign=bottom> <br>
+<font color="#000000" face="helvetica, arial"><a name="MediaUpload">class <strong>MediaUpload</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
+
+<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
+<td colspan=2><tt>Describes a media <a href="__builtin__.html#object">object</a> to upload.<br>
+ <br>
+Base class that defines the interface of <a href="#MediaUpload">MediaUpload</a> subclasses.<br> </tt></td></tr>
+<tr><td> </td>
+<td width="100%">Methods defined here:<br>
+<dl><dt><a name="MediaUpload-chunksize"><strong>chunksize</strong></a>(self)</dt></dl>
+
+<dl><dt><a name="MediaUpload-getbytes"><strong>getbytes</strong></a>(self, begin, end)</dt></dl>
+
+<dl><dt><a name="MediaUpload-mimetype"><strong>mimetype</strong></a>(self)</dt></dl>
+
+<dl><dt><a name="MediaUpload-resumable"><strong>resumable</strong></a>(self)</dt></dl>
+
+<dl><dt><a name="MediaUpload-size"><strong>size</strong></a>(self)</dt></dl>
+
+<dl><dt><a name="MediaUpload-to_json"><strong>to_json</strong></a>(self)</dt><dd><tt>Create a JSON representation of an instance of <a href="#MediaUpload">MediaUpload</a>.<br>
+ <br>
+Returns:<br>
+ string, a JSON representation of this instance, suitable to pass to<br>
+ from_json().</tt></dd></dl>
+
+<hr>
+Class methods defined here:<br>
+<dl><dt><a name="MediaUpload-new_from_json"><strong>new_from_json</strong></a>(cls, s)<font color="#909090"><font face="helvetica, arial"> from <a href="__builtin__.html#type">__builtin__.type</a></font></font></dt><dd><tt>Utility class method to instantiate a <a href="#MediaUpload">MediaUpload</a> subclass from a JSON<br>
+representation produced by <a href="#MediaUpload-to_json">to_json</a>().<br>
+ <br>
+Args:<br>
+ s: string, JSON from <a href="#MediaUpload-to_json">to_json</a>().<br>
+ <br>
+Returns:<br>
+ An instance of the subclass of <a href="#MediaUpload">MediaUpload</a> that was serialized with<br>
+ <a href="#MediaUpload-to_json">to_json</a>().</tt></dd></dl>
+
+<hr>
+Data descriptors defined here:<br>
+<dl><dt><strong>__dict__</strong></dt>
+<dd><tt>dictionary for instance variables (if defined)</tt></dd>
+</dl>
+<dl><dt><strong>__weakref__</strong></dt>
+<dd><tt>list of weak references to the object (if defined)</tt></dd>
+</dl>
+</td></tr></table> <p>
+<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
+<tr bgcolor="#ffc8d8">
+<td colspan=3 valign=bottom> <br>
+<font color="#000000" face="helvetica, arial"><a name="MediaUploadProgress">class <strong>MediaUploadProgress</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
+
+<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
+<td colspan=2><tt>Status of a resumable upload.<br> </tt></td></tr>
+<tr><td> </td>
+<td width="100%">Methods defined here:<br>
+<dl><dt><a name="MediaUploadProgress-__init__"><strong>__init__</strong></a>(self, resumable_progress, total_size)</dt><dd><tt>Constructor.<br>
+ <br>
+Args:<br>
+ resumable_progress: int, bytes sent so far.<br>
+ total_size: int, total bytes in complete upload.</tt></dd></dl>
+
+<dl><dt><a name="MediaUploadProgress-progress"><strong>progress</strong></a>(self)</dt><dd><tt>Percent of upload completed, as a float.</tt></dd></dl>
+
+<hr>
+Data descriptors defined here:<br>
+<dl><dt><strong>__dict__</strong></dt>
+<dd><tt>dictionary for instance variables (if defined)</tt></dd>
+</dl>
+<dl><dt><strong>__weakref__</strong></dt>
+<dd><tt>list of weak references to the object (if defined)</tt></dd>
+</dl>
+</td></tr></table> <p>
+<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
+<tr bgcolor="#ffc8d8">
+<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="RequestMockBuilder">class <strong>RequestMockBuilder</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
@@ -191,7 +618,24 @@
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
-<td width="100%"><dl><dt><a name="-tunnel_patch"><strong>tunnel_patch</strong></a>(http)</dt><dd><tt>Tunnel PATCH requests over POST.<br>
+<td width="100%"><dl><dt><a name="-set_user_agent"><strong>set_user_agent</strong></a>(http, user_agent)</dt><dd><tt>Set the user-agent on every request.<br>
+ <br>
+Args:<br>
+ http - An instance of httplib2.Http<br>
+ or something that acts like it.<br>
+ user_agent: string, the value for the user-agent header.<br>
+ <br>
+Returns:<br>
+ A modified instance of http that was passed in.<br>
+ <br>
+Example:<br>
+ <br>
+ h = httplib2.Http()<br>
+ h = <a href="#-set_user_agent">set_user_agent</a>(h, "my-app-name/6.0")<br>
+ <br>
+Most of the time the user-agent will be set doing auth, this is for the rare<br>
+cases where you are accessing an unauthenticated endpoint.</tt></dd></dl>
+ <dl><dt><a name="-tunnel_patch"><strong>tunnel_patch</strong></a>(http)</dt><dd><tt>Tunnel PATCH requests over POST.<br>
Args:<br>
http - An instance of httplib2.Http<br>
or something that acts like it.<br>
@@ -214,8 +658,7 @@
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
-<td width="100%"><strong>__all__</strong> = ['HttpRequest', 'RequestMockBuilder', 'HttpMockset_user_agent', 'tunnel_patch']<br>
-<strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'</td></tr></table><p>
+<td width="100%"><strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom> <br>