Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 1 | |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 3 | <html><head><title>Python: module apiclient.model</title> |
| 4 | </head><body bgcolor="#f0f0f8"> |
| 5 | |
| 6 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> |
| 7 | <tr bgcolor="#7799ee"> |
| 8 | <td valign=bottom> <br> |
| 9 | <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 |
| 10 | ><td align=right valign=bottom |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame^] | 11 | ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/jcgregorio/projects/apiclient/apiclient/model.py">/usr/local/google/home/jcgregorio/projects/apiclient/apiclient/model.py</a></font></td></tr></table> |
| 12 | <p><tt><a href="#Model">Model</a> objects for requests and responses.<br> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 13 | <br> |
| 14 | Each API may support one or more serializations, such<br> |
| 15 | as JSON, Atom, etc. The model classes are responsible<br> |
| 16 | for converting between the wire format and the Python<br> |
| 17 | <a href="__builtin__.html#object">object</a> representation.</tt></p> |
| 18 | <p> |
| 19 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 20 | <tr bgcolor="#aa55cc"> |
| 21 | <td colspan=3 valign=bottom> <br> |
| 22 | <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> |
| 23 | |
| 24 | <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> |
| 25 | <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="logging.html">logging</a><br> |
| 26 | </td><td width="25%" valign=top><a href="simplejson.html">simplejson</a><br> |
| 27 | </td><td width="25%" valign=top><a href="urllib.html">urllib</a><br> |
| 28 | </td><td width="25%" valign=top></td></tr></table></td></tr></table><p> |
| 29 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 30 | <tr bgcolor="#ee77aa"> |
| 31 | <td colspan=3 valign=bottom> <br> |
| 32 | <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> |
| 33 | |
| 34 | <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> |
| 35 | <td width="100%"><dl> |
| 36 | <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> |
| 37 | </font></dt><dd> |
| 38 | <dl> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 39 | <dt><font face="helvetica, arial"><a href="apiclient.model.html#Model">Model</a> |
| 40 | </font></dt><dd> |
| 41 | <dl> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 42 | <dt><font face="helvetica, arial"><a href="apiclient.model.html#JsonModel">JsonModel</a> |
| 43 | </font></dt></dl> |
| 44 | </dd> |
| 45 | </dl> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 46 | </dd> |
| 47 | </dl> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 48 | <p> |
| 49 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 50 | <tr bgcolor="#ffc8d8"> |
| 51 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 52 | <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> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 53 | |
| 54 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 55 | <td colspan=2><tt><a href="#Model">Model</a> class for JSON.<br> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 56 | <br> |
| 57 | Serializes and de-serializes between JSON and the Python<br> |
| 58 | <a href="__builtin__.html#object">object</a> representation of HTTP request and response bodies.<br> </tt></td></tr> |
| 59 | <tr><td> </td> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 60 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 61 | <dd><a href="apiclient.model.html#JsonModel">JsonModel</a></dd> |
| 62 | <dd><a href="apiclient.model.html#Model">Model</a></dd> |
| 63 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 64 | </dl> |
| 65 | <hr> |
| 66 | Methods defined here:<br> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 67 | <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> |
| 68 | <br> |
| 69 | Args:<br> |
| 70 | headers: dict, request headers<br> |
| 71 | path_params: dict, parameters that appear in the request path<br> |
| 72 | query_params: dict, parameters that appear in the query<br> |
| 73 | 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> |
| 74 | serializable by simplejson.<br> |
| 75 | Returns:<br> |
| 76 | A tuple of (headers, path_params, query, body)<br> |
| 77 | <br> |
| 78 | headers: dict, request headers<br> |
| 79 | path_params: dict, parameters that appear in the request path<br> |
| 80 | query: string, query part of the request URI<br> |
| 81 | body: string, the body serialized as JSON</tt></dd></dl> |
| 82 | |
| 83 | <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> |
| 84 | <br> |
| 85 | Args:<br> |
| 86 | resp: httplib2.Response, the HTTP response headers and status<br> |
| 87 | content: string, the body of the HTTP response<br> |
| 88 | <br> |
| 89 | Returns:<br> |
| 90 | The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.<br> |
| 91 | <br> |
| 92 | Raises:<br> |
| 93 | apiclient.errors.HttpError if a non 2xx response is received.</tt></dd></dl> |
| 94 | |
| 95 | <hr> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 96 | Data descriptors inherited from <a href="apiclient.model.html#Model">Model</a>:<br> |
| 97 | <dl><dt><strong>__dict__</strong></dt> |
| 98 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 99 | </dl> |
| 100 | <dl><dt><strong>__weakref__</strong></dt> |
| 101 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 102 | </dl> |
| 103 | </td></tr></table> <p> |
| 104 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 105 | <tr bgcolor="#ffc8d8"> |
| 106 | <td colspan=3 valign=bottom> <br> |
| 107 | <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> |
| 108 | |
| 109 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 110 | <td colspan=2><tt><a href="#Model">Model</a> base class.<br> |
| 111 | <br> |
| 112 | All <a href="#Model">Model</a> classes should implement this interface.<br> |
| 113 | The <a href="#Model">Model</a> serializes and de-serializes between a wire<br> |
| 114 | format such as JSON and a Python <a href="__builtin__.html#object">object</a> representation.<br> </tt></td></tr> |
| 115 | <tr><td> </td> |
| 116 | <td width="100%">Methods defined here:<br> |
| 117 | <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> |
| 118 | <br> |
| 119 | Args:<br> |
| 120 | headers: dict, request headers<br> |
| 121 | path_params: dict, parameters that appear in the request path<br> |
| 122 | query_params: dict, parameters that appear in the query<br> |
| 123 | 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> |
| 124 | serializable.<br> |
| 125 | Returns:<br> |
| 126 | A tuple of (headers, path_params, query, body)<br> |
| 127 | <br> |
| 128 | headers: dict, request headers<br> |
| 129 | path_params: dict, parameters that appear in the request path<br> |
| 130 | query: string, query part of the request URI<br> |
| 131 | body: string, the body serialized in the desired wire format.</tt></dd></dl> |
| 132 | |
| 133 | <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> |
| 134 | <br> |
| 135 | Args:<br> |
| 136 | resp: httplib2.Response, the HTTP response headers and status<br> |
| 137 | content: string, the body of the HTTP response<br> |
| 138 | <br> |
| 139 | Returns:<br> |
| 140 | The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.<br> |
| 141 | <br> |
| 142 | Raises:<br> |
| 143 | apiclient.errors.HttpError if a non 2xx response is received.</tt></dd></dl> |
| 144 | |
| 145 | <hr> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 146 | Data descriptors defined here:<br> |
| 147 | <dl><dt><strong>__dict__</strong></dt> |
| 148 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 149 | </dl> |
| 150 | <dl><dt><strong>__weakref__</strong></dt> |
| 151 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 152 | </dl> |
| 153 | </td></tr></table></td></tr></table><p> |
| 154 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 155 | <tr bgcolor="#55aa55"> |
| 156 | <td colspan=3 valign=bottom> <br> |
| 157 | <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> |
| 158 | |
| 159 | <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> |
| 160 | <td width="100%"><strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'</td></tr></table><p> |
| 161 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 162 | <tr bgcolor="#7799ee"> |
| 163 | <td colspan=3 valign=bottom> <br> |
| 164 | <font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr> |
| 165 | |
| 166 | <tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td> |
| 167 | <td width="100%">jcgregorio@google.com (Joe Gregorio)</td></tr></table> |
| 168 | </body></html> |