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