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