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