| |
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| <html><head><title>Python: module apiclient.model</title> |
| </head><body bgcolor="#f0f0f8"> |
| |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> |
| <tr bgcolor="#7799ee"> |
| <td valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="apiclient.html"><font color="#ffffff">apiclient</font></a>.model</strong></big></big></font></td |
| ><td align=right valign=bottom |
| ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/jcgregorio/projects/apiclient-release/apiclient/model.py">/home/jcgregorio/projects/apiclient-release/apiclient/model.py</a></font></td></tr></table> |
| <p><tt><a href="#Model">Model</a> objects for requests and responses.<br> |
| <br> |
| Each API may support one or more serializations, such<br> |
| as JSON, Atom, etc. The model classes are responsible<br> |
| for converting between the wire format and the Python<br> |
| <a href="__builtin__.html#object">object</a> representation.</tt></p> |
| <p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#aa55cc"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> |
| <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="gflags.html">gflags</a><br> |
| </td><td width="25%" valign=top><a href="logging.html">logging</a><br> |
| </td><td width="25%" valign=top><a href="simplejson.html">simplejson</a><br> |
| </td><td width="25%" valign=top><a href="urllib.html">urllib</a><br> |
| </td></tr></table></td></tr></table><p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#ee77aa"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> |
| <td width="100%"><dl> |
| <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.model.html#Model">Model</a> |
| </font></dt><dd> |
| <dl> |
| <dt><font face="helvetica, arial"><a href="apiclient.model.html#JsonModel">JsonModel</a> |
| </font></dt><dd> |
| <dl> |
| <dt><font face="helvetica, arial"><a href="apiclient.model.html#LoggingJsonModel">LoggingJsonModel</a> |
| </font></dt></dl> |
| </dd> |
| </dl> |
| </dd> |
| </dl> |
| </dd> |
| </dl> |
| <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="JsonModel">class <strong>JsonModel</strong></a>(<a href="apiclient.model.html#Model">Model</a>)</font></td></tr> |
| |
| <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| <td colspan=2><tt><a href="#Model">Model</a> class for JSON.<br> |
| <br> |
| Serializes and de-serializes between JSON and the Python<br> |
| <a href="__builtin__.html#object">object</a> representation of HTTP request and response bodies.<br> </tt></td></tr> |
| <tr><td> </td> |
| <td width="100%"><dl><dt>Method resolution order:</dt> |
| <dd><a href="apiclient.model.html#JsonModel">JsonModel</a></dd> |
| <dd><a href="apiclient.model.html#Model">Model</a></dd> |
| <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| </dl> |
| <hr> |
| Methods defined here:<br> |
| <dl><dt><a name="JsonModel-__init__"><strong>__init__</strong></a>(self, data_wrapper<font color="#909090">=False</font>)</dt><dd><tt>Construct a <a href="#JsonModel">JsonModel</a><br> |
| <br> |
| Args:<br> |
| data_wrapper: boolean, wrap requests and responses in a data wrapper</tt></dd></dl> |
| |
| <dl><dt><a name="JsonModel-request"><strong>request</strong></a>(self, headers, path_params, query_params, body_value)</dt><dd><tt>Updates outgoing requests with JSON bodies.<br> |
| <br> |
| Args:<br> |
| headers: dict, request headers<br> |
| path_params: dict, parameters that appear in the request path<br> |
| query_params: dict, parameters that appear in the query<br> |
| body_value: <a href="__builtin__.html#object">object</a>, the request body as a Python <a href="__builtin__.html#object">object</a>, which must be<br> |
| serializable by simplejson.<br> |
| Returns:<br> |
| A tuple of (headers, path_params, query, body)<br> |
| <br> |
| headers: dict, request headers<br> |
| path_params: dict, parameters that appear in the request path<br> |
| query: string, query part of the request URI<br> |
| body: string, the body serialized as JSON</tt></dd></dl> |
| |
| <dl><dt><a name="JsonModel-response"><strong>response</strong></a>(self, resp, content)</dt><dd><tt>Convert the response wire format into a Python <a href="__builtin__.html#object">object</a>.<br> |
| <br> |
| Args:<br> |
| resp: httplib2.Response, the HTTP response headers and status<br> |
| content: string, the body of the HTTP response<br> |
| <br> |
| Returns:<br> |
| The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.<br> |
| <br> |
| Raises:<br> |
| apiclient.errors.HttpError if a non 2xx response is received.</tt></dd></dl> |
| |
| <hr> |
| Data descriptors inherited from <a href="apiclient.model.html#Model">Model</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="LoggingJsonModel">class <strong>LoggingJsonModel</strong></a>(<a href="apiclient.model.html#JsonModel">JsonModel</a>)</font></td></tr> |
| |
| <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| <td colspan=2><tt>A printable <a href="#JsonModel">JsonModel</a> class that supports logging response info.<br> </tt></td></tr> |
| <tr><td> </td> |
| <td width="100%"><dl><dt>Method resolution order:</dt> |
| <dd><a href="apiclient.model.html#LoggingJsonModel">LoggingJsonModel</a></dd> |
| <dd><a href="apiclient.model.html#JsonModel">JsonModel</a></dd> |
| <dd><a href="apiclient.model.html#Model">Model</a></dd> |
| <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| </dl> |
| <hr> |
| Methods defined here:<br> |
| <dl><dt><a name="LoggingJsonModel-request"><strong>request</strong></a>(self, headers, path_params, query_params, body_value)</dt><dd><tt>An overloaded request method that will output debug info if requested.<br> |
| <br> |
| Args:<br> |
| headers: dict, request headers<br> |
| path_params: dict, parameters that appear in the request path<br> |
| query_params: dict, parameters that appear in the query<br> |
| body_value: <a href="__builtin__.html#object">object</a>, the request body as a Python <a href="__builtin__.html#object">object</a>, which must be<br> |
| serializable by simplejson.<br> |
| Returns:<br> |
| A tuple of (headers, path_params, query, body)<br> |
| <br> |
| headers: dict, request headers<br> |
| path_params: dict, parameters that appear in the request path<br> |
| query: string, query part of the request URI<br> |
| body: string, the body serialized as JSON</tt></dd></dl> |
| |
| <dl><dt><a name="LoggingJsonModel-response"><strong>response</strong></a>(self, resp, content)</dt><dd><tt>An overloaded response method that will output debug info if requested.<br> |
| <br> |
| Args:<br> |
| resp: An httplib2.Response <a href="__builtin__.html#object">object</a>.<br> |
| content: A string representing the response body.<br> |
| <br> |
| Returns:<br> |
| The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.</tt></dd></dl> |
| |
| <hr> |
| Methods inherited from <a href="apiclient.model.html#JsonModel">JsonModel</a>:<br> |
| <dl><dt><a name="LoggingJsonModel-__init__"><strong>__init__</strong></a>(self, data_wrapper<font color="#909090">=False</font>)</dt><dd><tt>Construct a <a href="#JsonModel">JsonModel</a><br> |
| <br> |
| Args:<br> |
| data_wrapper: boolean, wrap requests and responses in a data wrapper</tt></dd></dl> |
| |
| <hr> |
| Data descriptors inherited from <a href="apiclient.model.html#Model">Model</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="Model">class <strong>Model</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><a href="#Model">Model</a> base class.<br> |
| <br> |
| All <a href="#Model">Model</a> classes should implement this interface.<br> |
| The <a href="#Model">Model</a> serializes and de-serializes between a wire<br> |
| format such as JSON and a Python <a href="__builtin__.html#object">object</a> representation.<br> </tt></td></tr> |
| <tr><td> </td> |
| <td width="100%">Methods defined here:<br> |
| <dl><dt><a name="Model-request"><strong>request</strong></a>(self, headers, path_params, query_params, body_value)</dt><dd><tt>Updates outgoing requests with a deserialized body.<br> |
| <br> |
| Args:<br> |
| headers: dict, request headers<br> |
| path_params: dict, parameters that appear in the request path<br> |
| query_params: dict, parameters that appear in the query<br> |
| body_value: <a href="__builtin__.html#object">object</a>, the request body as a Python <a href="__builtin__.html#object">object</a>, which must be<br> |
| serializable.<br> |
| Returns:<br> |
| A tuple of (headers, path_params, query, body)<br> |
| <br> |
| headers: dict, request headers<br> |
| path_params: dict, parameters that appear in the request path<br> |
| query: string, query part of the request URI<br> |
| body: string, the body serialized in the desired wire format.</tt></dd></dl> |
| |
| <dl><dt><a name="Model-response"><strong>response</strong></a>(self, resp, content)</dt><dd><tt>Convert the response wire format into a Python <a href="__builtin__.html#object">object</a>.<br> |
| <br> |
| Args:<br> |
| resp: httplib2.Response, the HTTP response headers and status<br> |
| content: string, the body of the HTTP response<br> |
| <br> |
| Returns:<br> |
| The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.<br> |
| <br> |
| Raises:<br> |
| apiclient.errors.HttpError if a non 2xx response is received.</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></td></tr></table><p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#55aa55"> |
| <td colspan=3 valign=bottom> <br> |
| <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>FLAGS</strong> = <gflags.FlagValues instance><br> |
| <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> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td> |
| <td width="100%">jcgregorio@google.com (Joe Gregorio)</td></tr></table> |
| </body></html> |