Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 1 | <?xml version="1.0" encoding="ascii"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 3 | "DTD/xhtml1-transitional.dtd"> |
| 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 5 | <head> |
| 6 | <title>apiclient.http.BatchHttpRequest</title> |
| 7 | <link rel="stylesheet" href="epydoc.css" type="text/css" /> |
| 8 | <script type="text/javascript" src="epydoc.js"></script> |
| 9 | </head> |
| 10 | |
| 11 | <body bgcolor="white" text="black" link="blue" vlink="#204080" |
| 12 | alink="#204080"> |
| 13 | <!-- ==================== NAVIGATION BAR ==================== --> |
| 14 | <table class="navbar" border="0" width="100%" cellpadding="0" |
| 15 | bgcolor="#a0c0ff" cellspacing="0"> |
| 16 | <tr valign="middle"> |
| 17 | |
| 18 | <!-- Tree link --> |
| 19 | <th> <a |
| 20 | href="module-tree.html">Trees</a> </th> |
| 21 | |
| 22 | <!-- Index link --> |
| 23 | <th> <a |
| 24 | href="identifier-index.html">Indices</a> </th> |
| 25 | |
| 26 | <!-- Help link --> |
| 27 | <th> <a |
| 28 | href="help.html">Help</a> </th> |
| 29 | |
| 30 | <th class="navbar" width="100%"></th> |
| 31 | </tr> |
| 32 | </table> |
| 33 | <table width="100%" cellpadding="0" cellspacing="0"> |
| 34 | <tr valign="top"> |
| 35 | <td width="100%"> |
| 36 | <span class="breadcrumbs"> |
| 37 | <a href="apiclient-module.html">Package apiclient</a> :: |
| 38 | <a href="apiclient.http-module.html">Module http</a> :: |
| 39 | Class BatchHttpRequest |
| 40 | </span> |
| 41 | </td> |
| 42 | <td> |
| 43 | <table cellpadding="0" cellspacing="0"> |
| 44 | <!-- hide/show private --> |
| 45 | <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" |
| 46 | onclick="toggle_private();">hide private</a>]</span></td></tr> |
| 47 | <tr><td align="right"><span class="options" |
| 48 | >[<a href="frames.html" target="_top">frames</a |
| 49 | >] | <a href="apiclient.http.BatchHttpRequest-class.html" |
| 50 | target="_top">no frames</a>]</span></td></tr> |
| 51 | </table> |
| 52 | </td> |
| 53 | </tr> |
| 54 | </table> |
| 55 | <!-- ==================== CLASS DESCRIPTION ==================== --> |
| 56 | <h1 class="epydoc">Class BatchHttpRequest</h1><p class="nomargin-top"><span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest">source code</a></span></p> |
| 57 | <center> |
Joe Gregorio | 746096f | 2012-06-15 10:53:36 -0400 | [diff] [blame] | 58 | <center> <map id="class_hierarchy_for_batchhttpr" name="class_hierarchy_for_batchhttpr"> |
| 59 | <area shape="rect" href="apiclient.http.BatchHttpRequest-class.html" title="BatchHttpRequest" alt="" coords="5,5,133,32"/> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 60 | </map> |
Joe Gregorio | 746096f | 2012-06-15 10:53:36 -0400 | [diff] [blame] | 61 | <img src="class_hierarchy_for_batchhttpr.gif" alt='' usemap="#class_hierarchy_for_batchhttpr" ismap="ismap" class="graph-without-title" /> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 62 | </center> |
| 63 | </center> |
| 64 | <hr /> |
| 65 | <pre class="literalblock"> |
| 66 | Batches multiple HttpRequest objects into a single HTTP request. |
| 67 | |
Joe Gregorio | ebd0b84 | 2012-06-15 14:14:17 -0400 | [diff] [blame] | 68 | Example: |
| 69 | from apiclient.http import BatchHttpRequest |
| 70 | |
Joe Gregorio | e7a0c47 | 2012-07-12 11:46:04 -0400 | [diff] [blame] | 71 | def list_animals(request_id, response, exception): |
Joe Gregorio | ebd0b84 | 2012-06-15 14:14:17 -0400 | [diff] [blame] | 72 | """Do something with the animals list response.""" |
Joe Gregorio | e7a0c47 | 2012-07-12 11:46:04 -0400 | [diff] [blame] | 73 | if exception is not None: |
| 74 | # Do something with the exception. |
| 75 | pass |
| 76 | else: |
| 77 | # Do something with the response. |
| 78 | pass |
Joe Gregorio | ebd0b84 | 2012-06-15 14:14:17 -0400 | [diff] [blame] | 79 | |
Joe Gregorio | e7a0c47 | 2012-07-12 11:46:04 -0400 | [diff] [blame] | 80 | def list_farmers(request_id, response, exception): |
Joe Gregorio | ebd0b84 | 2012-06-15 14:14:17 -0400 | [diff] [blame] | 81 | """Do something with the farmers list response.""" |
Joe Gregorio | e7a0c47 | 2012-07-12 11:46:04 -0400 | [diff] [blame] | 82 | if exception is not None: |
| 83 | # Do something with the exception. |
| 84 | pass |
| 85 | else: |
| 86 | # Do something with the response. |
| 87 | pass |
Joe Gregorio | ebd0b84 | 2012-06-15 14:14:17 -0400 | [diff] [blame] | 88 | |
| 89 | service = build('farm', 'v2') |
| 90 | |
| 91 | batch = BatchHttpRequest() |
| 92 | |
| 93 | batch.add(service.animals().list(), list_animals) |
| 94 | batch.add(service.farmers().list(), list_farmers) |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 95 | batch.execute(http=http) |
Joe Gregorio | ebd0b84 | 2012-06-15 14:14:17 -0400 | [diff] [blame] | 96 | |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 97 | </pre> |
| 98 | |
| 99 | <!-- ==================== INSTANCE METHODS ==================== --> |
| 100 | <a name="section-InstanceMethods"></a> |
| 101 | <table class="summary" border="1" cellpadding="3" |
| 102 | cellspacing="0" width="100%" bgcolor="white"> |
| 103 | <tr bgcolor="#70b0f0" class="table-header"> |
| 104 | <td colspan="2" class="table-header"> |
| 105 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 106 | <tr valign="top"> |
| 107 | <td align="left"><span class="table-header">Instance Methods</span></td> |
| 108 | <td align="right" valign="top" |
| 109 | ><span class="options">[<a href="#section-InstanceMethods" |
| 110 | class="privatelink" onclick="toggle_private();" |
| 111 | >hide private</a>]</span></td> |
| 112 | </tr> |
| 113 | </table> |
| 114 | </td> |
| 115 | </tr> |
| 116 | <tr> |
| 117 | <td width="15%" align="right" valign="top" class="summary"> |
| 118 | <span class="summary-type"> </span> |
| 119 | </td><td class="summary"> |
| 120 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 121 | <tr> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 122 | <td><span class="summary-sig"><a href="apiclient.http.BatchHttpRequest-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">*args</span>, |
| 123 | <span class="summary-sig-arg">**kwargs</span>)</span><br /> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 124 | Constructor for a BatchHttpRequest.</td> |
| 125 | <td align="right" valign="top"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 126 | <span class="codelink"><a href="oauth2client.util-pysrc.html">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 127 | |
| 128 | </td> |
| 129 | </tr> |
| 130 | </table> |
| 131 | |
| 132 | </td> |
| 133 | </tr> |
| 134 | <tr class="private"> |
| 135 | <td width="15%" align="right" valign="top" class="summary"> |
| 136 | <span class="summary-type"> </span> |
| 137 | </td><td class="summary"> |
| 138 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 139 | <tr> |
| 140 | <td><span class="summary-sig"><a href="apiclient.http.BatchHttpRequest-class.html#_refresh_and_apply_credentials" class="summary-sig-name" onclick="show_private();">_refresh_and_apply_credentials</a>(<span class="summary-sig-arg">self</span>, |
| 141 | <span class="summary-sig-arg">request</span>, |
| 142 | <span class="summary-sig-arg">http</span>)</span><br /> |
| 143 | Refresh the credentials and apply to the request.</td> |
| 144 | <td align="right" valign="top"> |
| 145 | <span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._refresh_and_apply_credentials">source code</a></span> |
| 146 | |
| 147 | </td> |
| 148 | </tr> |
| 149 | </table> |
| 150 | |
| 151 | </td> |
| 152 | </tr> |
| 153 | <tr class="private"> |
| 154 | <td width="15%" align="right" valign="top" class="summary"> |
| 155 | <span class="summary-type"> </span> |
| 156 | </td><td class="summary"> |
| 157 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 158 | <tr> |
| 159 | <td><span class="summary-sig"><a href="apiclient.http.BatchHttpRequest-class.html#_id_to_header" class="summary-sig-name" onclick="show_private();">_id_to_header</a>(<span class="summary-sig-arg">self</span>, |
| 160 | <span class="summary-sig-arg">id_</span>)</span><br /> |
| 161 | Convert an id to a Content-ID header value.</td> |
| 162 | <td align="right" valign="top"> |
| 163 | <span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._id_to_header">source code</a></span> |
| 164 | |
| 165 | </td> |
| 166 | </tr> |
| 167 | </table> |
| 168 | |
| 169 | </td> |
| 170 | </tr> |
| 171 | <tr class="private"> |
| 172 | <td width="15%" align="right" valign="top" class="summary"> |
| 173 | <span class="summary-type"> </span> |
| 174 | </td><td class="summary"> |
| 175 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 176 | <tr> |
| 177 | <td><span class="summary-sig"><a href="apiclient.http.BatchHttpRequest-class.html#_header_to_id" class="summary-sig-name" onclick="show_private();">_header_to_id</a>(<span class="summary-sig-arg">self</span>, |
| 178 | <span class="summary-sig-arg">header</span>)</span><br /> |
| 179 | Convert a Content-ID header value to an id.</td> |
| 180 | <td align="right" valign="top"> |
| 181 | <span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._header_to_id">source code</a></span> |
| 182 | |
| 183 | </td> |
| 184 | </tr> |
| 185 | </table> |
| 186 | |
| 187 | </td> |
| 188 | </tr> |
| 189 | <tr class="private"> |
| 190 | <td width="15%" align="right" valign="top" class="summary"> |
| 191 | <span class="summary-type"> </span> |
| 192 | </td><td class="summary"> |
| 193 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 194 | <tr> |
| 195 | <td><span class="summary-sig"><a href="apiclient.http.BatchHttpRequest-class.html#_serialize_request" class="summary-sig-name" onclick="show_private();">_serialize_request</a>(<span class="summary-sig-arg">self</span>, |
| 196 | <span class="summary-sig-arg">request</span>)</span><br /> |
| 197 | Convert an HttpRequest object into a string.</td> |
| 198 | <td align="right" valign="top"> |
| 199 | <span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._serialize_request">source code</a></span> |
| 200 | |
| 201 | </td> |
| 202 | </tr> |
| 203 | </table> |
| 204 | |
| 205 | </td> |
| 206 | </tr> |
| 207 | <tr class="private"> |
| 208 | <td width="15%" align="right" valign="top" class="summary"> |
| 209 | <span class="summary-type"> </span> |
| 210 | </td><td class="summary"> |
| 211 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 212 | <tr> |
| 213 | <td><span class="summary-sig"><a href="apiclient.http.BatchHttpRequest-class.html#_deserialize_response" class="summary-sig-name" onclick="show_private();">_deserialize_response</a>(<span class="summary-sig-arg">self</span>, |
| 214 | <span class="summary-sig-arg">payload</span>)</span><br /> |
| 215 | Convert string into httplib2 response and content.</td> |
| 216 | <td align="right" valign="top"> |
| 217 | <span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._deserialize_response">source code</a></span> |
| 218 | |
| 219 | </td> |
| 220 | </tr> |
| 221 | </table> |
| 222 | |
| 223 | </td> |
| 224 | </tr> |
| 225 | <tr class="private"> |
| 226 | <td width="15%" align="right" valign="top" class="summary"> |
| 227 | <span class="summary-type"> </span> |
| 228 | </td><td class="summary"> |
| 229 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 230 | <tr> |
| 231 | <td><span class="summary-sig"><a href="apiclient.http.BatchHttpRequest-class.html#_new_id" class="summary-sig-name" onclick="show_private();">_new_id</a>(<span class="summary-sig-arg">self</span>)</span><br /> |
| 232 | Create a new id.</td> |
| 233 | <td align="right" valign="top"> |
| 234 | <span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._new_id">source code</a></span> |
| 235 | |
| 236 | </td> |
| 237 | </tr> |
| 238 | </table> |
| 239 | |
| 240 | </td> |
| 241 | </tr> |
| 242 | <tr> |
| 243 | <td width="15%" align="right" valign="top" class="summary"> |
| 244 | <span class="summary-type"> </span> |
| 245 | </td><td class="summary"> |
| 246 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 247 | <tr> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 248 | <td><span class="summary-sig"><a href="apiclient.http.BatchHttpRequest-class.html#add" class="summary-sig-name">add</a>(<span class="summary-sig-arg">*args</span>, |
| 249 | <span class="summary-sig-arg">**kwargs</span>)</span><br /> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 250 | Add a new request.</td> |
| 251 | <td align="right" valign="top"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 252 | <span class="codelink"><a href="oauth2client.util-pysrc.html">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 253 | |
| 254 | </td> |
| 255 | </tr> |
| 256 | </table> |
| 257 | |
| 258 | </td> |
| 259 | </tr> |
| 260 | <tr class="private"> |
| 261 | <td width="15%" align="right" valign="top" class="summary"> |
| 262 | <span class="summary-type"> </span> |
| 263 | </td><td class="summary"> |
| 264 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 265 | <tr> |
| 266 | <td><span class="summary-sig"><a href="apiclient.http.BatchHttpRequest-class.html#_execute" class="summary-sig-name" onclick="show_private();">_execute</a>(<span class="summary-sig-arg">self</span>, |
| 267 | <span class="summary-sig-arg">http</span>, |
| 268 | <span class="summary-sig-arg">order</span>, |
| 269 | <span class="summary-sig-arg">requests</span>)</span><br /> |
| 270 | Serialize batch request, send to server, process response.</td> |
| 271 | <td align="right" valign="top"> |
| 272 | <span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._execute">source code</a></span> |
| 273 | |
| 274 | </td> |
| 275 | </tr> |
| 276 | </table> |
| 277 | |
| 278 | </td> |
| 279 | </tr> |
| 280 | <tr> |
| 281 | <td width="15%" align="right" valign="top" class="summary"> |
| 282 | <span class="summary-type"> </span> |
| 283 | </td><td class="summary"> |
| 284 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 285 | <tr> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 286 | <td><span class="summary-sig"><a href="apiclient.http.BatchHttpRequest-class.html#execute" class="summary-sig-name">execute</a>(<span class="summary-sig-arg">*args</span>, |
| 287 | <span class="summary-sig-arg">**kwargs</span>)</span><br /> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 288 | Execute all the requests as a single batched HTTP request.</td> |
| 289 | <td align="right" valign="top"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 290 | <span class="codelink"><a href="oauth2client.util-pysrc.html">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 291 | |
| 292 | </td> |
| 293 | </tr> |
| 294 | </table> |
| 295 | |
| 296 | </td> |
| 297 | </tr> |
| 298 | <tr> |
| 299 | <td colspan="2" class="summary"> |
| 300 | <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| 301 | <code>__delattr__</code>, |
| 302 | <code>__format__</code>, |
| 303 | <code>__getattribute__</code>, |
| 304 | <code>__hash__</code>, |
| 305 | <code>__new__</code>, |
| 306 | <code>__reduce__</code>, |
| 307 | <code>__reduce_ex__</code>, |
| 308 | <code>__repr__</code>, |
| 309 | <code>__setattr__</code>, |
| 310 | <code>__sizeof__</code>, |
| 311 | <code>__str__</code>, |
| 312 | <code>__subclasshook__</code> |
| 313 | </p> |
| 314 | </td> |
| 315 | </tr> |
| 316 | </table> |
| 317 | <!-- ==================== PROPERTIES ==================== --> |
| 318 | <a name="section-Properties"></a> |
| 319 | <table class="summary" border="1" cellpadding="3" |
| 320 | cellspacing="0" width="100%" bgcolor="white"> |
| 321 | <tr bgcolor="#70b0f0" class="table-header"> |
| 322 | <td colspan="2" class="table-header"> |
| 323 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 324 | <tr valign="top"> |
| 325 | <td align="left"><span class="table-header">Properties</span></td> |
| 326 | <td align="right" valign="top" |
| 327 | ><span class="options">[<a href="#section-Properties" |
| 328 | class="privatelink" onclick="toggle_private();" |
| 329 | >hide private</a>]</span></td> |
| 330 | </tr> |
| 331 | </table> |
| 332 | </td> |
| 333 | </tr> |
| 334 | <tr> |
| 335 | <td colspan="2" class="summary"> |
| 336 | <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| 337 | <code>__class__</code> |
| 338 | </p> |
| 339 | </td> |
| 340 | </tr> |
| 341 | </table> |
| 342 | <!-- ==================== METHOD DETAILS ==================== --> |
| 343 | <a name="section-MethodDetails"></a> |
| 344 | <table class="details" border="1" cellpadding="3" |
| 345 | cellspacing="0" width="100%" bgcolor="white"> |
| 346 | <tr bgcolor="#70b0f0" class="table-header"> |
| 347 | <td colspan="2" class="table-header"> |
| 348 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 349 | <tr valign="top"> |
| 350 | <td align="left"><span class="table-header">Method Details</span></td> |
| 351 | <td align="right" valign="top" |
| 352 | ><span class="options">[<a href="#section-MethodDetails" |
| 353 | class="privatelink" onclick="toggle_private();" |
| 354 | >hide private</a>]</span></td> |
| 355 | </tr> |
| 356 | </table> |
| 357 | </td> |
| 358 | </tr> |
| 359 | </table> |
| 360 | <a name="__init__"></a> |
| 361 | <div> |
| 362 | <table class="details" border="1" cellpadding="3" |
| 363 | cellspacing="0" width="100%" bgcolor="white"> |
| 364 | <tr><td> |
| 365 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 366 | <tr valign="top"><td> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 367 | <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">*args</span>, |
| 368 | <span class="sig-arg">**kwargs</span>)</span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 369 | <br /><em class="fname">(Constructor)</em> |
| 370 | </h3> |
| 371 | </td><td align="right" valign="top" |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 372 | ><span class="codelink"><a href="oauth2client.util-pysrc.html">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 373 | </td> |
| 374 | </tr></table> |
| 375 | |
| 376 | <pre class="literalblock"> |
| 377 | Constructor for a BatchHttpRequest. |
| 378 | |
| 379 | Args: |
| 380 | callback: callable, A callback to be called for each response, of the |
Joe Gregorio | e7a0c47 | 2012-07-12 11:46:04 -0400 | [diff] [blame] | 381 | form callback(id, response, exception). The first parameter is the |
| 382 | request id, and the second is the deserialized response object. The |
| 383 | third is an apiclient.errors.HttpError exception object if an HTTP error |
| 384 | occurred while processing the request, or None if no error occurred. |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 385 | batch_uri: string, URI to send batch requests to. |
| 386 | |
| 387 | </pre> |
| 388 | <dl class="fields"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 389 | <dt>Decorators:</dt> |
| 390 | <dd><ul class="nomargin-top"> |
| 391 | <li><code>@util.positional(1)</code></li> |
| 392 | </ul></dd> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 393 | <dt>Overrides: |
| 394 | object.__init__ |
| 395 | </dt> |
| 396 | </dl> |
| 397 | </td></tr></table> |
| 398 | </div> |
| 399 | <a name="_refresh_and_apply_credentials"></a> |
| 400 | <div class="private"> |
| 401 | <table class="details" border="1" cellpadding="3" |
| 402 | cellspacing="0" width="100%" bgcolor="white"> |
| 403 | <tr><td> |
| 404 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 405 | <tr valign="top"><td> |
| 406 | <h3 class="epydoc"><span class="sig"><span class="sig-name">_refresh_and_apply_credentials</span>(<span class="sig-arg">self</span>, |
| 407 | <span class="sig-arg">request</span>, |
| 408 | <span class="sig-arg">http</span>)</span> |
| 409 | </h3> |
| 410 | </td><td align="right" valign="top" |
| 411 | ><span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._refresh_and_apply_credentials">source code</a></span> |
| 412 | </td> |
| 413 | </tr></table> |
| 414 | |
| 415 | <pre class="literalblock"> |
| 416 | Refresh the credentials and apply to the request. |
| 417 | |
| 418 | Args: |
| 419 | request: HttpRequest, the request. |
| 420 | http: httplib2.Http, the global http object for the batch. |
| 421 | |
| 422 | </pre> |
| 423 | <dl class="fields"> |
| 424 | </dl> |
| 425 | </td></tr></table> |
| 426 | </div> |
| 427 | <a name="_id_to_header"></a> |
| 428 | <div class="private"> |
| 429 | <table class="details" border="1" cellpadding="3" |
| 430 | cellspacing="0" width="100%" bgcolor="white"> |
| 431 | <tr><td> |
| 432 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 433 | <tr valign="top"><td> |
| 434 | <h3 class="epydoc"><span class="sig"><span class="sig-name">_id_to_header</span>(<span class="sig-arg">self</span>, |
| 435 | <span class="sig-arg">id_</span>)</span> |
| 436 | </h3> |
| 437 | </td><td align="right" valign="top" |
| 438 | ><span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._id_to_header">source code</a></span> |
| 439 | </td> |
| 440 | </tr></table> |
| 441 | |
| 442 | <pre class="literalblock"> |
| 443 | Convert an id to a Content-ID header value. |
| 444 | |
| 445 | Args: |
| 446 | id_: string, identifier of individual request. |
| 447 | |
| 448 | Returns: |
| 449 | A Content-ID header with the id_ encoded into it. A UUID is prepended to |
| 450 | the value because Content-ID headers are supposed to be universally |
| 451 | unique. |
| 452 | |
| 453 | </pre> |
| 454 | <dl class="fields"> |
| 455 | </dl> |
| 456 | </td></tr></table> |
| 457 | </div> |
| 458 | <a name="_header_to_id"></a> |
| 459 | <div class="private"> |
| 460 | <table class="details" border="1" cellpadding="3" |
| 461 | cellspacing="0" width="100%" bgcolor="white"> |
| 462 | <tr><td> |
| 463 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 464 | <tr valign="top"><td> |
| 465 | <h3 class="epydoc"><span class="sig"><span class="sig-name">_header_to_id</span>(<span class="sig-arg">self</span>, |
| 466 | <span class="sig-arg">header</span>)</span> |
| 467 | </h3> |
| 468 | </td><td align="right" valign="top" |
| 469 | ><span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._header_to_id">source code</a></span> |
| 470 | </td> |
| 471 | </tr></table> |
| 472 | |
| 473 | <pre class="literalblock"> |
| 474 | Convert a Content-ID header value to an id. |
| 475 | |
| 476 | Presumes the Content-ID header conforms to the format that _id_to_header() |
| 477 | returns. |
| 478 | |
| 479 | Args: |
| 480 | header: string, Content-ID header value. |
| 481 | |
| 482 | Returns: |
| 483 | The extracted id value. |
| 484 | |
| 485 | Raises: |
| 486 | BatchError if the header is not in the expected format. |
| 487 | |
| 488 | </pre> |
| 489 | <dl class="fields"> |
| 490 | </dl> |
| 491 | </td></tr></table> |
| 492 | </div> |
| 493 | <a name="_serialize_request"></a> |
| 494 | <div class="private"> |
| 495 | <table class="details" border="1" cellpadding="3" |
| 496 | cellspacing="0" width="100%" bgcolor="white"> |
| 497 | <tr><td> |
| 498 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 499 | <tr valign="top"><td> |
| 500 | <h3 class="epydoc"><span class="sig"><span class="sig-name">_serialize_request</span>(<span class="sig-arg">self</span>, |
| 501 | <span class="sig-arg">request</span>)</span> |
| 502 | </h3> |
| 503 | </td><td align="right" valign="top" |
| 504 | ><span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._serialize_request">source code</a></span> |
| 505 | </td> |
| 506 | </tr></table> |
| 507 | |
| 508 | <pre class="literalblock"> |
| 509 | Convert an HttpRequest object into a string. |
| 510 | |
| 511 | Args: |
| 512 | request: HttpRequest, the request to serialize. |
| 513 | |
| 514 | Returns: |
| 515 | The request as a string in application/http format. |
| 516 | |
| 517 | </pre> |
| 518 | <dl class="fields"> |
| 519 | </dl> |
| 520 | </td></tr></table> |
| 521 | </div> |
| 522 | <a name="_deserialize_response"></a> |
| 523 | <div class="private"> |
| 524 | <table class="details" border="1" cellpadding="3" |
| 525 | cellspacing="0" width="100%" bgcolor="white"> |
| 526 | <tr><td> |
| 527 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 528 | <tr valign="top"><td> |
| 529 | <h3 class="epydoc"><span class="sig"><span class="sig-name">_deserialize_response</span>(<span class="sig-arg">self</span>, |
| 530 | <span class="sig-arg">payload</span>)</span> |
| 531 | </h3> |
| 532 | </td><td align="right" valign="top" |
| 533 | ><span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._deserialize_response">source code</a></span> |
| 534 | </td> |
| 535 | </tr></table> |
| 536 | |
| 537 | <pre class="literalblock"> |
| 538 | Convert string into httplib2 response and content. |
| 539 | |
| 540 | Args: |
| 541 | payload: string, headers and body as a string. |
| 542 | |
| 543 | Returns: |
Joe Gregorio | e7a0c47 | 2012-07-12 11:46:04 -0400 | [diff] [blame] | 544 | A pair (resp, content), such as would be returned from httplib2.request. |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 545 | |
| 546 | </pre> |
| 547 | <dl class="fields"> |
| 548 | </dl> |
| 549 | </td></tr></table> |
| 550 | </div> |
| 551 | <a name="_new_id"></a> |
| 552 | <div class="private"> |
| 553 | <table class="details" border="1" cellpadding="3" |
| 554 | cellspacing="0" width="100%" bgcolor="white"> |
| 555 | <tr><td> |
| 556 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 557 | <tr valign="top"><td> |
| 558 | <h3 class="epydoc"><span class="sig"><span class="sig-name">_new_id</span>(<span class="sig-arg">self</span>)</span> |
| 559 | </h3> |
| 560 | </td><td align="right" valign="top" |
| 561 | ><span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._new_id">source code</a></span> |
| 562 | </td> |
| 563 | </tr></table> |
| 564 | |
| 565 | <pre class="literalblock"> |
| 566 | Create a new id. |
| 567 | |
| 568 | Auto incrementing number that avoids conflicts with ids already used. |
| 569 | |
| 570 | Returns: |
| 571 | string, a new unique id. |
| 572 | |
| 573 | </pre> |
| 574 | <dl class="fields"> |
| 575 | </dl> |
| 576 | </td></tr></table> |
| 577 | </div> |
| 578 | <a name="add"></a> |
| 579 | <div> |
| 580 | <table class="details" border="1" cellpadding="3" |
| 581 | cellspacing="0" width="100%" bgcolor="white"> |
| 582 | <tr><td> |
| 583 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 584 | <tr valign="top"><td> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 585 | <h3 class="epydoc"><span class="sig"><span class="sig-name">add</span>(<span class="sig-arg">*args</span>, |
| 586 | <span class="sig-arg">**kwargs</span>)</span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 587 | </h3> |
| 588 | </td><td align="right" valign="top" |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 589 | ><span class="codelink"><a href="oauth2client.util-pysrc.html">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 590 | </td> |
| 591 | </tr></table> |
| 592 | |
| 593 | <pre class="literalblock"> |
| 594 | Add a new request. |
| 595 | |
| 596 | Every callback added will be paired with a unique id, the request_id. That |
| 597 | unique id will be passed back to the callback when the response comes back |
| 598 | from the server. The default behavior is to have the library generate it's |
| 599 | own unique id. If the caller passes in a request_id then they must ensure |
| 600 | uniqueness for each request_id, and if they are not an exception is |
| 601 | raised. Callers should either supply all request_ids or nevery supply a |
| 602 | request id, to avoid such an error. |
| 603 | |
| 604 | Args: |
| 605 | request: HttpRequest, Request to add to the batch. |
| 606 | callback: callable, A callback to be called for this response, of the |
Joe Gregorio | e7a0c47 | 2012-07-12 11:46:04 -0400 | [diff] [blame] | 607 | form callback(id, response, exception). The first parameter is the |
| 608 | request id, and the second is the deserialized response object. The |
| 609 | third is an apiclient.errors.HttpError exception object if an HTTP error |
| 610 | occurred while processing the request, or None if no errors occurred. |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 611 | request_id: string, A unique id for the request. The id will be passed to |
| 612 | the callback with the response. |
| 613 | |
| 614 | Returns: |
| 615 | None |
| 616 | |
| 617 | Raises: |
Joe Gregorio | ebd0b84 | 2012-06-15 14:14:17 -0400 | [diff] [blame] | 618 | BatchError if a media request is added to a batch. |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 619 | KeyError is the request_id is not unique. |
| 620 | |
| 621 | </pre> |
| 622 | <dl class="fields"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 623 | <dt>Decorators:</dt> |
| 624 | <dd><ul class="nomargin-top"> |
| 625 | <li><code>@util.positional(2)</code></li> |
| 626 | </ul></dd> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 627 | </dl> |
| 628 | </td></tr></table> |
| 629 | </div> |
| 630 | <a name="_execute"></a> |
| 631 | <div class="private"> |
| 632 | <table class="details" border="1" cellpadding="3" |
| 633 | cellspacing="0" width="100%" bgcolor="white"> |
| 634 | <tr><td> |
| 635 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 636 | <tr valign="top"><td> |
| 637 | <h3 class="epydoc"><span class="sig"><span class="sig-name">_execute</span>(<span class="sig-arg">self</span>, |
| 638 | <span class="sig-arg">http</span>, |
| 639 | <span class="sig-arg">order</span>, |
| 640 | <span class="sig-arg">requests</span>)</span> |
| 641 | </h3> |
| 642 | </td><td align="right" valign="top" |
| 643 | ><span class="codelink"><a href="apiclient.http-pysrc.html#BatchHttpRequest._execute">source code</a></span> |
| 644 | </td> |
| 645 | </tr></table> |
| 646 | |
| 647 | <pre class="literalblock"> |
| 648 | Serialize batch request, send to server, process response. |
| 649 | |
| 650 | Args: |
| 651 | http: httplib2.Http, an http object to be used to make the request with. |
| 652 | order: list, list of request ids in the order they were added to the |
| 653 | batch. |
| 654 | request: list, list of request objects to send. |
| 655 | |
| 656 | Raises: |
Joe Gregorio | ad8013f | 2012-08-03 08:44:02 -0400 | [diff] [blame] | 657 | httplib2.HttpLib2Error if a transport error has occured. |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 658 | apiclient.errors.BatchError if the response is the wrong format. |
| 659 | |
| 660 | </pre> |
| 661 | <dl class="fields"> |
| 662 | </dl> |
| 663 | </td></tr></table> |
| 664 | </div> |
| 665 | <a name="execute"></a> |
| 666 | <div> |
| 667 | <table class="details" border="1" cellpadding="3" |
| 668 | cellspacing="0" width="100%" bgcolor="white"> |
| 669 | <tr><td> |
| 670 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 671 | <tr valign="top"><td> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 672 | <h3 class="epydoc"><span class="sig"><span class="sig-name">execute</span>(<span class="sig-arg">*args</span>, |
| 673 | <span class="sig-arg">**kwargs</span>)</span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 674 | </h3> |
| 675 | </td><td align="right" valign="top" |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 676 | ><span class="codelink"><a href="oauth2client.util-pysrc.html">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 677 | </td> |
| 678 | </tr></table> |
| 679 | |
| 680 | <pre class="literalblock"> |
| 681 | Execute all the requests as a single batched HTTP request. |
| 682 | |
| 683 | Args: |
| 684 | http: httplib2.Http, an http object to be used in place of the one the |
| 685 | HttpRequest request object was constructed with. If one isn't supplied |
| 686 | then use a http object from the requests in this batch. |
| 687 | |
| 688 | Returns: |
| 689 | None |
| 690 | |
| 691 | Raises: |
Joe Gregorio | ad8013f | 2012-08-03 08:44:02 -0400 | [diff] [blame] | 692 | httplib2.HttpLib2Error if a transport error has occured. |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 693 | apiclient.errors.BatchError if the response is the wrong format. |
| 694 | |
| 695 | </pre> |
| 696 | <dl class="fields"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 697 | <dt>Decorators:</dt> |
| 698 | <dd><ul class="nomargin-top"> |
| 699 | <li><code>@util.positional(1)</code></li> |
| 700 | </ul></dd> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 701 | </dl> |
| 702 | </td></tr></table> |
| 703 | </div> |
| 704 | <br /> |
| 705 | <!-- ==================== NAVIGATION BAR ==================== --> |
| 706 | <table class="navbar" border="0" width="100%" cellpadding="0" |
| 707 | bgcolor="#a0c0ff" cellspacing="0"> |
| 708 | <tr valign="middle"> |
| 709 | |
| 710 | <!-- Tree link --> |
| 711 | <th> <a |
| 712 | href="module-tree.html">Trees</a> </th> |
| 713 | |
| 714 | <!-- Index link --> |
| 715 | <th> <a |
| 716 | href="identifier-index.html">Indices</a> </th> |
| 717 | |
| 718 | <!-- Help link --> |
| 719 | <th> <a |
| 720 | href="help.html">Help</a> </th> |
| 721 | |
| 722 | <th class="navbar" width="100%"></th> |
| 723 | </tr> |
| 724 | </table> |
| 725 | <table border="0" cellpadding="0" cellspacing="0" width="100%%"> |
| 726 | <tr> |
| 727 | <td align="left" class="footer"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame^] | 728 | Generated by Epydoc 3.0.1 on Fri Aug 24 11:02:02 2012 |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 729 | </td> |
| 730 | <td align="right" class="footer"> |
| 731 | <a target="mainFrame" href="http://epydoc.sourceforge.net" |
| 732 | >http://epydoc.sourceforge.net</a> |
| 733 | </td> |
| 734 | </tr> |
| 735 | </table> |
| 736 | |
| 737 | <script type="text/javascript"> |
| 738 | <!-- |
| 739 | // Private objects are initially displayed (because if |
| 740 | // javascript is turned off then we want them to be |
| 741 | // visible); but by default, we want to hide them. So hide |
| 742 | // them unless we have a cookie that says to show them. |
| 743 | checkCookie(); |
| 744 | // --> |
| 745 | </script> |
| 746 | </body> |
| 747 | </html> |