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