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 | 6621203 | 2012-06-14 09:10:14 -0400 | [diff] [blame] | 11 | ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/jcgregorio/projects/clean/apiclient/model.py">/home/jcgregorio/projects/clean/apiclient/model.py</a></font></td></tr></table> |
Joe Gregorio | 3b79fa8 | 2011-02-17 11:47:17 -0500 | [diff] [blame] | 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> |
Joe Gregorio | 4939655 | 2011-03-08 10:39:00 -0500 | [diff] [blame] | 25 | <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="gflags.html">gflags</a><br> |
| 26 | </td><td width="25%" valign=top><a href="logging.html">logging</a><br> |
Joe Gregorio | 3d55ac5 | 2012-02-21 10:11:19 -0500 | [diff] [blame] | 27 | </td><td width="25%" valign=top><a href="json.html">json</a><br> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 28 | </td><td width="25%" valign=top><a href="urllib.html">urllib</a><br> |
Joe Gregorio | 4939655 | 2011-03-08 10:39:00 -0500 | [diff] [blame] | 29 | </td></tr></table></td></tr></table><p> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 30 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 31 | <tr bgcolor="#ee77aa"> |
| 32 | <td colspan=3 valign=bottom> <br> |
| 33 | <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> |
| 34 | |
| 35 | <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> |
| 36 | <td width="100%"><dl> |
| 37 | <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> |
| 38 | </font></dt><dd> |
| 39 | <dl> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 40 | <dt><font face="helvetica, arial"><a href="apiclient.model.html#Model">Model</a> |
| 41 | </font></dt><dd> |
| 42 | <dl> |
Joe Gregorio | 351b149 | 2011-05-08 23:32:46 -0700 | [diff] [blame] | 43 | <dt><font face="helvetica, arial"><a href="apiclient.model.html#BaseModel">BaseModel</a> |
Joe Gregorio | 4939655 | 2011-03-08 10:39:00 -0500 | [diff] [blame] | 44 | </font></dt><dd> |
| 45 | <dl> |
Joe Gregorio | 351b149 | 2011-05-08 23:32:46 -0700 | [diff] [blame] | 46 | <dt><font face="helvetica, arial"><a href="apiclient.model.html#JsonModel">JsonModel</a> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 47 | </font></dt><dd> |
| 48 | <dl> |
Joe Gregorio | ebd0b84 | 2012-06-15 14:14:17 -0400 | [diff] [blame] | 49 | <dt><font face="helvetica, arial"><a href="apiclient.model.html#MediaModel">MediaModel</a> |
| 50 | </font></dt><dt><font face="helvetica, arial"><a href="apiclient.model.html#RawModel">RawModel</a> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 51 | </font></dt></dl> |
| 52 | </dd> |
| 53 | <dt><font face="helvetica, arial"><a href="apiclient.model.html#ProtocolBufferModel">ProtocolBufferModel</a> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 54 | </font></dt></dl> |
| 55 | </dd> |
| 56 | </dl> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 57 | </dd> |
| 58 | </dl> |
Joe Gregorio | 4939655 | 2011-03-08 10:39:00 -0500 | [diff] [blame] | 59 | </dd> |
| 60 | </dl> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 61 | <p> |
| 62 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 63 | <tr bgcolor="#ffc8d8"> |
| 64 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | 351b149 | 2011-05-08 23:32:46 -0700 | [diff] [blame] | 65 | <font color="#000000" face="helvetica, arial"><a name="BaseModel">class <strong>BaseModel</strong></a>(<a href="apiclient.model.html#Model">Model</a>)</font></td></tr> |
| 66 | |
| 67 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 68 | <td colspan=2><tt>Base model class.<br> |
| 69 | <br> |
| 70 | Subclasses should provide implementations for the "serialize" and<br> |
| 71 | "deserialize" methods, as well as values for the following class attributes.<br> |
| 72 | <br> |
| 73 | Attributes:<br> |
| 74 | accept: The value to use for the HTTP Accept header.<br> |
| 75 | content_type: The value to use for the HTTP Content-type header.<br> |
| 76 | no_content_response: The value to return when deserializing a 204 "No<br> |
| 77 | Content" response.<br> |
| 78 | alt_param: The value to supply as the "alt" query parameter for requests.<br> </tt></td></tr> |
| 79 | <tr><td> </td> |
| 80 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 81 | <dd><a href="apiclient.model.html#BaseModel">BaseModel</a></dd> |
| 82 | <dd><a href="apiclient.model.html#Model">Model</a></dd> |
| 83 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 84 | </dl> |
| 85 | <hr> |
| 86 | Methods defined here:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 87 | <dl><dt><a name="BaseModel-deserialize"><strong>deserialize</strong></a>(self, content)</dt><dd><tt>Perform the actual deserialization from response string to Python<br> |
| 88 | <a href="__builtin__.html#object">object</a>.<br> |
Joe Gregorio | 351b149 | 2011-05-08 23:32:46 -0700 | [diff] [blame] | 89 | <br> |
| 90 | Args:<br> |
| 91 | content: string, the body of the HTTP response<br> |
| 92 | <br> |
| 93 | Returns:<br> |
| 94 | The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.</tt></dd></dl> |
| 95 | |
| 96 | <dl><dt><a name="BaseModel-request"><strong>request</strong></a>(self, headers, path_params, query_params, body_value)</dt><dd><tt>Updates outgoing requests with a serialized body.<br> |
| 97 | <br> |
| 98 | Args:<br> |
| 99 | headers: dict, request headers<br> |
| 100 | path_params: dict, parameters that appear in the request path<br> |
| 101 | query_params: dict, parameters that appear in the query<br> |
| 102 | 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> |
| 103 | serializable by simplejson.<br> |
| 104 | Returns:<br> |
| 105 | A tuple of (headers, path_params, query, body)<br> |
| 106 | <br> |
| 107 | headers: dict, request headers<br> |
| 108 | path_params: dict, parameters that appear in the request path<br> |
| 109 | query: string, query part of the request URI<br> |
| 110 | body: string, the body serialized as JSON</tt></dd></dl> |
| 111 | |
| 112 | <dl><dt><a name="BaseModel-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> |
| 113 | <br> |
| 114 | Args:<br> |
| 115 | resp: httplib2.Response, the HTTP response headers and status<br> |
| 116 | content: string, the body of the HTTP response<br> |
| 117 | <br> |
| 118 | Returns:<br> |
| 119 | The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.<br> |
| 120 | <br> |
| 121 | Raises:<br> |
| 122 | apiclient.errors.HttpError if a non 2xx response is received.</tt></dd></dl> |
| 123 | |
| 124 | <dl><dt><a name="BaseModel-serialize"><strong>serialize</strong></a>(self, body_value)</dt><dd><tt>Perform the actual Python <a href="__builtin__.html#object">object</a> serialization.<br> |
| 125 | <br> |
| 126 | Args:<br> |
| 127 | body_value: <a href="__builtin__.html#object">object</a>, the request body as a Python <a href="__builtin__.html#object">object</a>.<br> |
| 128 | <br> |
| 129 | Returns:<br> |
| 130 | string, the body in serialized form.</tt></dd></dl> |
| 131 | |
| 132 | <hr> |
| 133 | Data and other attributes defined here:<br> |
| 134 | <dl><dt><strong>accept</strong> = None</dl> |
| 135 | |
| 136 | <dl><dt><strong>alt_param</strong> = None</dl> |
| 137 | |
| 138 | <dl><dt><strong>content_type</strong> = None</dl> |
| 139 | |
| 140 | <dl><dt><strong>no_content_response</strong> = None</dl> |
| 141 | |
| 142 | <hr> |
| 143 | Data descriptors inherited from <a href="apiclient.model.html#Model">Model</a>:<br> |
| 144 | <dl><dt><strong>__dict__</strong></dt> |
| 145 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 146 | </dl> |
| 147 | <dl><dt><strong>__weakref__</strong></dt> |
| 148 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 149 | </dl> |
| 150 | </td></tr></table> <p> |
| 151 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 152 | <tr bgcolor="#ffc8d8"> |
| 153 | <td colspan=3 valign=bottom> <br> |
| 154 | <font color="#000000" face="helvetica, arial"><a name="JsonModel">class <strong>JsonModel</strong></a>(<a href="apiclient.model.html#BaseModel">BaseModel</a>)</font></td></tr> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 155 | |
| 156 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 157 | <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] | 158 | <br> |
| 159 | Serializes and de-serializes between JSON and the Python<br> |
| 160 | <a href="__builtin__.html#object">object</a> representation of HTTP request and response bodies.<br> </tt></td></tr> |
| 161 | <tr><td> </td> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 162 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 163 | <dd><a href="apiclient.model.html#JsonModel">JsonModel</a></dd> |
Joe Gregorio | 351b149 | 2011-05-08 23:32:46 -0700 | [diff] [blame] | 164 | <dd><a href="apiclient.model.html#BaseModel">BaseModel</a></dd> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 165 | <dd><a href="apiclient.model.html#Model">Model</a></dd> |
| 166 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 167 | </dl> |
| 168 | <hr> |
| 169 | Methods defined here:<br> |
Joe Gregorio | 351b149 | 2011-05-08 23:32:46 -0700 | [diff] [blame] | 170 | <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> |
Joe Gregorio | ad258e2 | 2011-02-22 22:53:30 -0500 | [diff] [blame] | 171 | <br> |
| 172 | Args:<br> |
| 173 | data_wrapper: boolean, wrap requests and responses in a data wrapper</tt></dd></dl> |
| 174 | |
Joe Gregorio | 351b149 | 2011-05-08 23:32:46 -0700 | [diff] [blame] | 175 | <dl><dt><a name="JsonModel-deserialize"><strong>deserialize</strong></a>(self, content)</dt></dl> |
| 176 | |
| 177 | <dl><dt><a name="JsonModel-serialize"><strong>serialize</strong></a>(self, body_value)</dt></dl> |
| 178 | |
| 179 | <hr> |
| 180 | Data descriptors defined here:<br> |
| 181 | <dl><dt><strong>no_content_response</strong></dt> |
| 182 | </dl> |
| 183 | <hr> |
| 184 | Data and other attributes defined here:<br> |
| 185 | <dl><dt><strong>accept</strong> = 'application/json'</dl> |
| 186 | |
| 187 | <dl><dt><strong>alt_param</strong> = 'json'</dl> |
| 188 | |
| 189 | <dl><dt><strong>content_type</strong> = 'application/json'</dl> |
| 190 | |
| 191 | <hr> |
| 192 | Methods inherited from <a href="apiclient.model.html#BaseModel">BaseModel</a>:<br> |
| 193 | <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 a serialized body.<br> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 194 | <br> |
| 195 | Args:<br> |
| 196 | headers: dict, request headers<br> |
| 197 | path_params: dict, parameters that appear in the request path<br> |
| 198 | query_params: dict, parameters that appear in the query<br> |
| 199 | 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> |
| 200 | serializable by simplejson.<br> |
| 201 | Returns:<br> |
| 202 | A tuple of (headers, path_params, query, body)<br> |
| 203 | <br> |
| 204 | headers: dict, request headers<br> |
| 205 | path_params: dict, parameters that appear in the request path<br> |
| 206 | query: string, query part of the request URI<br> |
| 207 | body: string, the body serialized as JSON</tt></dd></dl> |
| 208 | |
| 209 | <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> |
| 210 | <br> |
| 211 | Args:<br> |
| 212 | resp: httplib2.Response, the HTTP response headers and status<br> |
| 213 | content: string, the body of the HTTP response<br> |
| 214 | <br> |
| 215 | Returns:<br> |
| 216 | The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.<br> |
| 217 | <br> |
| 218 | Raises:<br> |
| 219 | apiclient.errors.HttpError if a non 2xx response is received.</tt></dd></dl> |
| 220 | |
| 221 | <hr> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 222 | Data descriptors inherited from <a href="apiclient.model.html#Model">Model</a>:<br> |
| 223 | <dl><dt><strong>__dict__</strong></dt> |
| 224 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 225 | </dl> |
| 226 | <dl><dt><strong>__weakref__</strong></dt> |
| 227 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 228 | </dl> |
| 229 | </td></tr></table> <p> |
| 230 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 231 | <tr bgcolor="#ffc8d8"> |
| 232 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | ebd0b84 | 2012-06-15 14:14:17 -0400 | [diff] [blame] | 233 | <font color="#000000" face="helvetica, arial"><a name="MediaModel">class <strong>MediaModel</strong></a>(<a href="apiclient.model.html#JsonModel">JsonModel</a>)</font></td></tr> |
| 234 | |
| 235 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 236 | <td colspan=2><tt><a href="#Model">Model</a> class for requests that return Media.<br> |
| 237 | <br> |
| 238 | Serializes and de-serializes between JSON and the Python<br> |
| 239 | <a href="__builtin__.html#object">object</a> representation of HTTP request, and returns the raw bytes<br> |
| 240 | of the response body.<br> </tt></td></tr> |
| 241 | <tr><td> </td> |
| 242 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 243 | <dd><a href="apiclient.model.html#MediaModel">MediaModel</a></dd> |
| 244 | <dd><a href="apiclient.model.html#JsonModel">JsonModel</a></dd> |
| 245 | <dd><a href="apiclient.model.html#BaseModel">BaseModel</a></dd> |
| 246 | <dd><a href="apiclient.model.html#Model">Model</a></dd> |
| 247 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 248 | </dl> |
| 249 | <hr> |
| 250 | Methods defined here:<br> |
| 251 | <dl><dt><a name="MediaModel-deserialize"><strong>deserialize</strong></a>(self, content)</dt></dl> |
| 252 | |
| 253 | <hr> |
| 254 | Data descriptors defined here:<br> |
| 255 | <dl><dt><strong>no_content_response</strong></dt> |
| 256 | </dl> |
| 257 | <hr> |
| 258 | Data and other attributes defined here:<br> |
| 259 | <dl><dt><strong>accept</strong> = '*/*'</dl> |
| 260 | |
| 261 | <dl><dt><strong>alt_param</strong> = 'media'</dl> |
| 262 | |
| 263 | <dl><dt><strong>content_type</strong> = 'application/json'</dl> |
| 264 | |
| 265 | <hr> |
| 266 | Methods inherited from <a href="apiclient.model.html#JsonModel">JsonModel</a>:<br> |
| 267 | <dl><dt><a name="MediaModel-__init__"><strong>__init__</strong></a>(self, data_wrapper<font color="#909090">=False</font>)</dt><dd><tt>Construct a <a href="#JsonModel">JsonModel</a>.<br> |
| 268 | <br> |
| 269 | Args:<br> |
| 270 | data_wrapper: boolean, wrap requests and responses in a data wrapper</tt></dd></dl> |
| 271 | |
| 272 | <dl><dt><a name="MediaModel-serialize"><strong>serialize</strong></a>(self, body_value)</dt></dl> |
| 273 | |
| 274 | <hr> |
| 275 | Methods inherited from <a href="apiclient.model.html#BaseModel">BaseModel</a>:<br> |
| 276 | <dl><dt><a name="MediaModel-request"><strong>request</strong></a>(self, headers, path_params, query_params, body_value)</dt><dd><tt>Updates outgoing requests with a serialized body.<br> |
| 277 | <br> |
| 278 | Args:<br> |
| 279 | headers: dict, request headers<br> |
| 280 | path_params: dict, parameters that appear in the request path<br> |
| 281 | query_params: dict, parameters that appear in the query<br> |
| 282 | 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> |
| 283 | serializable by simplejson.<br> |
| 284 | Returns:<br> |
| 285 | A tuple of (headers, path_params, query, body)<br> |
| 286 | <br> |
| 287 | headers: dict, request headers<br> |
| 288 | path_params: dict, parameters that appear in the request path<br> |
| 289 | query: string, query part of the request URI<br> |
| 290 | body: string, the body serialized as JSON</tt></dd></dl> |
| 291 | |
| 292 | <dl><dt><a name="MediaModel-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> |
| 293 | <br> |
| 294 | Args:<br> |
| 295 | resp: httplib2.Response, the HTTP response headers and status<br> |
| 296 | content: string, the body of the HTTP response<br> |
| 297 | <br> |
| 298 | Returns:<br> |
| 299 | The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.<br> |
| 300 | <br> |
| 301 | Raises:<br> |
| 302 | apiclient.errors.HttpError if a non 2xx response is received.</tt></dd></dl> |
| 303 | |
| 304 | <hr> |
| 305 | Data descriptors inherited from <a href="apiclient.model.html#Model">Model</a>:<br> |
| 306 | <dl><dt><strong>__dict__</strong></dt> |
| 307 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 308 | </dl> |
| 309 | <dl><dt><strong>__weakref__</strong></dt> |
| 310 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 311 | </dl> |
| 312 | </td></tr></table> <p> |
| 313 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 314 | <tr bgcolor="#ffc8d8"> |
| 315 | <td colspan=3 valign=bottom> <br> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 316 | <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> |
| 317 | |
| 318 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 319 | <td colspan=2><tt><a href="#Model">Model</a> base class.<br> |
| 320 | <br> |
| 321 | All <a href="#Model">Model</a> classes should implement this interface.<br> |
| 322 | The <a href="#Model">Model</a> serializes and de-serializes between a wire<br> |
| 323 | format such as JSON and a Python <a href="__builtin__.html#object">object</a> representation.<br> </tt></td></tr> |
| 324 | <tr><td> </td> |
| 325 | <td width="100%">Methods defined here:<br> |
Joe Gregorio | 351b149 | 2011-05-08 23:32:46 -0700 | [diff] [blame] | 326 | <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 serialized body.<br> |
Joe Gregorio | abda96f | 2011-02-11 20:19:33 -0500 | [diff] [blame] | 327 | <br> |
| 328 | Args:<br> |
| 329 | headers: dict, request headers<br> |
| 330 | path_params: dict, parameters that appear in the request path<br> |
| 331 | query_params: dict, parameters that appear in the query<br> |
| 332 | 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> |
| 333 | serializable.<br> |
| 334 | Returns:<br> |
| 335 | A tuple of (headers, path_params, query, body)<br> |
| 336 | <br> |
| 337 | headers: dict, request headers<br> |
| 338 | path_params: dict, parameters that appear in the request path<br> |
| 339 | query: string, query part of the request URI<br> |
| 340 | body: string, the body serialized in the desired wire format.</tt></dd></dl> |
| 341 | |
| 342 | <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> |
| 343 | <br> |
| 344 | Args:<br> |
| 345 | resp: httplib2.Response, the HTTP response headers and status<br> |
| 346 | content: string, the body of the HTTP response<br> |
| 347 | <br> |
| 348 | Returns:<br> |
| 349 | The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.<br> |
| 350 | <br> |
| 351 | Raises:<br> |
| 352 | apiclient.errors.HttpError if a non 2xx response is received.</tt></dd></dl> |
| 353 | |
| 354 | <hr> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 355 | Data descriptors defined here:<br> |
| 356 | <dl><dt><strong>__dict__</strong></dt> |
| 357 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 358 | </dl> |
| 359 | <dl><dt><strong>__weakref__</strong></dt> |
| 360 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 361 | </dl> |
Joe Gregorio | 351b149 | 2011-05-08 23:32:46 -0700 | [diff] [blame] | 362 | </td></tr></table> <p> |
| 363 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 364 | <tr bgcolor="#ffc8d8"> |
| 365 | <td colspan=3 valign=bottom> <br> |
| 366 | <font color="#000000" face="helvetica, arial"><a name="ProtocolBufferModel">class <strong>ProtocolBufferModel</strong></a>(<a href="apiclient.model.html#BaseModel">BaseModel</a>)</font></td></tr> |
| 367 | |
| 368 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 369 | <td colspan=2><tt><a href="#Model">Model</a> class for protocol buffers.<br> |
| 370 | <br> |
| 371 | Serializes and de-serializes the binary protocol buffer sent in the HTTP<br> |
| 372 | request and response bodies.<br> </tt></td></tr> |
| 373 | <tr><td> </td> |
| 374 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 375 | <dd><a href="apiclient.model.html#ProtocolBufferModel">ProtocolBufferModel</a></dd> |
| 376 | <dd><a href="apiclient.model.html#BaseModel">BaseModel</a></dd> |
| 377 | <dd><a href="apiclient.model.html#Model">Model</a></dd> |
| 378 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 379 | </dl> |
| 380 | <hr> |
| 381 | Methods defined here:<br> |
| 382 | <dl><dt><a name="ProtocolBufferModel-__init__"><strong>__init__</strong></a>(self, protocol_buffer)</dt><dd><tt>Constructs a <a href="#ProtocolBufferModel">ProtocolBufferModel</a>.<br> |
| 383 | <br> |
| 384 | The serialzed protocol buffer returned in an HTTP response will be<br> |
| 385 | de-serialized using the given protocol buffer class.<br> |
| 386 | <br> |
| 387 | Args:<br> |
Joe Gregorio | a845167 | 2011-09-15 09:53:21 -0400 | [diff] [blame] | 388 | protocol_buffer: The protocol buffer class used to de-serialize a<br> |
| 389 | response from the API.</tt></dd></dl> |
Joe Gregorio | 351b149 | 2011-05-08 23:32:46 -0700 | [diff] [blame] | 390 | |
| 391 | <dl><dt><a name="ProtocolBufferModel-deserialize"><strong>deserialize</strong></a>(self, content)</dt></dl> |
| 392 | |
| 393 | <dl><dt><a name="ProtocolBufferModel-serialize"><strong>serialize</strong></a>(self, body_value)</dt></dl> |
| 394 | |
| 395 | <hr> |
| 396 | Data descriptors defined here:<br> |
| 397 | <dl><dt><strong>no_content_response</strong></dt> |
| 398 | </dl> |
| 399 | <hr> |
| 400 | Data and other attributes defined here:<br> |
| 401 | <dl><dt><strong>accept</strong> = 'application/x-protobuf'</dl> |
| 402 | |
| 403 | <dl><dt><strong>alt_param</strong> = 'proto'</dl> |
| 404 | |
| 405 | <dl><dt><strong>content_type</strong> = 'application/x-protobuf'</dl> |
| 406 | |
| 407 | <hr> |
| 408 | Methods inherited from <a href="apiclient.model.html#BaseModel">BaseModel</a>:<br> |
| 409 | <dl><dt><a name="ProtocolBufferModel-request"><strong>request</strong></a>(self, headers, path_params, query_params, body_value)</dt><dd><tt>Updates outgoing requests with a serialized body.<br> |
| 410 | <br> |
| 411 | Args:<br> |
| 412 | headers: dict, request headers<br> |
| 413 | path_params: dict, parameters that appear in the request path<br> |
| 414 | query_params: dict, parameters that appear in the query<br> |
| 415 | 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> |
| 416 | serializable by simplejson.<br> |
| 417 | Returns:<br> |
| 418 | A tuple of (headers, path_params, query, body)<br> |
| 419 | <br> |
| 420 | headers: dict, request headers<br> |
| 421 | path_params: dict, parameters that appear in the request path<br> |
| 422 | query: string, query part of the request URI<br> |
| 423 | body: string, the body serialized as JSON</tt></dd></dl> |
| 424 | |
| 425 | <dl><dt><a name="ProtocolBufferModel-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> |
| 426 | <br> |
| 427 | Args:<br> |
| 428 | resp: httplib2.Response, the HTTP response headers and status<br> |
| 429 | content: string, the body of the HTTP response<br> |
| 430 | <br> |
| 431 | Returns:<br> |
| 432 | The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.<br> |
| 433 | <br> |
| 434 | Raises:<br> |
| 435 | apiclient.errors.HttpError if a non 2xx response is received.</tt></dd></dl> |
| 436 | |
| 437 | <hr> |
| 438 | Data descriptors inherited from <a href="apiclient.model.html#Model">Model</a>:<br> |
| 439 | <dl><dt><strong>__dict__</strong></dt> |
| 440 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 441 | </dl> |
| 442 | <dl><dt><strong>__weakref__</strong></dt> |
| 443 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 444 | </dl> |
Joe Gregorio | b417caf | 2011-12-08 12:04:24 -0500 | [diff] [blame] | 445 | </td></tr></table> <p> |
| 446 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 447 | <tr bgcolor="#ffc8d8"> |
| 448 | <td colspan=3 valign=bottom> <br> |
| 449 | <font color="#000000" face="helvetica, arial"><a name="RawModel">class <strong>RawModel</strong></a>(<a href="apiclient.model.html#JsonModel">JsonModel</a>)</font></td></tr> |
| 450 | |
| 451 | <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| 452 | <td colspan=2><tt><a href="#Model">Model</a> class for requests that don't return JSON.<br> |
| 453 | <br> |
| 454 | Serializes and de-serializes between JSON and the Python<br> |
| 455 | <a href="__builtin__.html#object">object</a> representation of HTTP request, and returns the raw bytes<br> |
| 456 | of the response body.<br> </tt></td></tr> |
| 457 | <tr><td> </td> |
| 458 | <td width="100%"><dl><dt>Method resolution order:</dt> |
| 459 | <dd><a href="apiclient.model.html#RawModel">RawModel</a></dd> |
| 460 | <dd><a href="apiclient.model.html#JsonModel">JsonModel</a></dd> |
| 461 | <dd><a href="apiclient.model.html#BaseModel">BaseModel</a></dd> |
| 462 | <dd><a href="apiclient.model.html#Model">Model</a></dd> |
| 463 | <dd><a href="__builtin__.html#object">__builtin__.object</a></dd> |
| 464 | </dl> |
| 465 | <hr> |
| 466 | Methods defined here:<br> |
| 467 | <dl><dt><a name="RawModel-deserialize"><strong>deserialize</strong></a>(self, content)</dt></dl> |
| 468 | |
| 469 | <hr> |
| 470 | Data descriptors defined here:<br> |
| 471 | <dl><dt><strong>no_content_response</strong></dt> |
| 472 | </dl> |
| 473 | <hr> |
| 474 | Data and other attributes defined here:<br> |
| 475 | <dl><dt><strong>accept</strong> = '*/*'</dl> |
| 476 | |
| 477 | <dl><dt><strong>alt_param</strong> = None</dl> |
| 478 | |
| 479 | <dl><dt><strong>content_type</strong> = 'application/json'</dl> |
| 480 | |
| 481 | <hr> |
| 482 | Methods inherited from <a href="apiclient.model.html#JsonModel">JsonModel</a>:<br> |
| 483 | <dl><dt><a name="RawModel-__init__"><strong>__init__</strong></a>(self, data_wrapper<font color="#909090">=False</font>)</dt><dd><tt>Construct a <a href="#JsonModel">JsonModel</a>.<br> |
| 484 | <br> |
| 485 | Args:<br> |
| 486 | data_wrapper: boolean, wrap requests and responses in a data wrapper</tt></dd></dl> |
| 487 | |
| 488 | <dl><dt><a name="RawModel-serialize"><strong>serialize</strong></a>(self, body_value)</dt></dl> |
| 489 | |
| 490 | <hr> |
| 491 | Methods inherited from <a href="apiclient.model.html#BaseModel">BaseModel</a>:<br> |
| 492 | <dl><dt><a name="RawModel-request"><strong>request</strong></a>(self, headers, path_params, query_params, body_value)</dt><dd><tt>Updates outgoing requests with a serialized body.<br> |
| 493 | <br> |
| 494 | Args:<br> |
| 495 | headers: dict, request headers<br> |
| 496 | path_params: dict, parameters that appear in the request path<br> |
| 497 | query_params: dict, parameters that appear in the query<br> |
| 498 | 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> |
| 499 | serializable by simplejson.<br> |
| 500 | Returns:<br> |
| 501 | A tuple of (headers, path_params, query, body)<br> |
| 502 | <br> |
| 503 | headers: dict, request headers<br> |
| 504 | path_params: dict, parameters that appear in the request path<br> |
| 505 | query: string, query part of the request URI<br> |
| 506 | body: string, the body serialized as JSON</tt></dd></dl> |
| 507 | |
| 508 | <dl><dt><a name="RawModel-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> |
| 509 | <br> |
| 510 | Args:<br> |
| 511 | resp: httplib2.Response, the HTTP response headers and status<br> |
| 512 | content: string, the body of the HTTP response<br> |
| 513 | <br> |
| 514 | Returns:<br> |
| 515 | The body de-serialized as a Python <a href="__builtin__.html#object">object</a>.<br> |
| 516 | <br> |
| 517 | Raises:<br> |
| 518 | apiclient.errors.HttpError if a non 2xx response is received.</tt></dd></dl> |
| 519 | |
| 520 | <hr> |
| 521 | Data descriptors inherited from <a href="apiclient.model.html#Model">Model</a>:<br> |
| 522 | <dl><dt><strong>__dict__</strong></dt> |
| 523 | <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 524 | </dl> |
| 525 | <dl><dt><strong>__weakref__</strong></dt> |
| 526 | <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 527 | </dl> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 528 | </td></tr></table></td></tr></table><p> |
| 529 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
Joe Gregorio | b9e63ff | 2011-06-30 12:38:10 -0400 | [diff] [blame] | 530 | <tr bgcolor="#eeaa77"> |
| 531 | <td colspan=3 valign=bottom> <br> |
| 532 | <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> |
| 533 | |
| 534 | <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> |
| 535 | <td width="100%"><dl><dt><a name="-makepatch"><strong>makepatch</strong></a>(original, modified)</dt><dd><tt>Create a patch <a href="__builtin__.html#object">object</a>.<br> |
| 536 | <br> |
| 537 | Some methods support PATCH, an efficient way to send updates to a resource.<br> |
| 538 | This method allows the easy construction of patch bodies by looking at the<br> |
| 539 | differences between a resource before and after it was modified.<br> |
| 540 | <br> |
| 541 | Args:<br> |
| 542 | original: <a href="__builtin__.html#object">object</a>, the original deserialized resource<br> |
| 543 | modified: <a href="__builtin__.html#object">object</a>, the modified deserialized resource<br> |
| 544 | Returns:<br> |
| 545 | An <a href="__builtin__.html#object">object</a> that contains only the changes from original to modified, in a<br> |
| 546 | form suitable to pass to a PATCH method.<br> |
| 547 | <br> |
| 548 | Example usage:<br> |
| 549 | item = service.activities().get(postid=postid, userid=userid).execute()<br> |
| 550 | original = copy.deepcopy(item)<br> |
| 551 | item['<a href="__builtin__.html#object">object</a>']['content'] = 'This is updated.'<br> |
| 552 | service.activities.patch(postid=postid, userid=userid,<br> |
| 553 | body=<a href="#-makepatch">makepatch</a>(original, item)).execute()</tt></dd></dl> |
| 554 | </td></tr></table><p> |
| 555 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 556 | <tr bgcolor="#55aa55"> |
| 557 | <td colspan=3 valign=bottom> <br> |
| 558 | <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> |
| 559 | |
| 560 | <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> |
Joe Gregorio | 4939655 | 2011-03-08 10:39:00 -0500 | [diff] [blame] | 561 | <td width="100%"><strong>FLAGS</strong> = <gflags.FlagValues instance><br> |
| 562 | <strong>__author__</strong> = 'jcgregorio@google.com (Joe Gregorio)'</td></tr></table><p> |
Joe Gregorio | 30dfdc3 | 2010-12-09 16:34:22 -0500 | [diff] [blame] | 563 | <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| 564 | <tr bgcolor="#7799ee"> |
| 565 | <td colspan=3 valign=bottom> <br> |
| 566 | <font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr> |
| 567 | |
| 568 | <tr><td bgcolor="#7799ee"><tt> </tt></td><td> </td> |
| 569 | <td width="100%">jcgregorio@google.com (Joe Gregorio)</td></tr></table> |
| 570 | </body></html> |