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.HttpRequest</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 HttpRequest |
| 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.HttpRequest-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 HttpRequest</h1><p class="nomargin-top"><span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest">source code</a></span></p> |
| 57 | <center> |
Joe Gregorio | 37802c3 | 2013-08-06 12:24:05 -0400 | [diff] [blame] | 58 | <center> <map id="uml_class_diagram_for_apiclien_22" name="uml_class_diagram_for_apiclien_22"> |
| 59 | <area shape="rect" id="node64" href="apiclient.http.HttpRequest-class.html#__init__" title="Constructor for an HttpRequest." alt="" coords="17,39,677,57"/> |
| 60 | <area shape="rect" id="node64" href="apiclient.http.HttpRequest-class.html#execute" title="Execute the request." alt="" coords="17,57,677,76"/> |
| 61 | <area shape="rect" id="node64" href="apiclient.http.HttpRequest-class.html#add_response_callback" title="add_response_headers_callback" alt="" coords="17,76,677,95"/> |
| 62 | <area shape="rect" id="node64" href="apiclient.http.HttpRequest-class.html#next_chunk" title="Execute the next step of a resumable upload." alt="" coords="17,95,677,113"/> |
| 63 | <area shape="rect" id="node64" href="apiclient.http.HttpRequest-class.html#to_json" title="Returns a JSON representation of the HttpRequest." alt="" coords="17,113,677,132"/> |
| 64 | <area shape="rect" id="node64" href="apiclient.http.HttpRequest-class.html#from_json" title="Returns an HttpRequest populated with info from a JSON object." alt="" coords="17,132,677,151"/> |
| 65 | <area shape="rect" id="node1" href="apiclient.http.HttpRequest-class.html" title="Encapsulates a single HTTP request." alt="" coords="5,6,688,157"/> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 66 | </map> |
Joe Gregorio | 37802c3 | 2013-08-06 12:24:05 -0400 | [diff] [blame] | 67 | <img src="uml_class_diagram_for_apiclien_22.gif" alt='' usemap="#uml_class_diagram_for_apiclien_22" ismap="ismap" class="graph-without-title" /> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 68 | </center> |
| 69 | </center> |
| 70 | <hr /> |
| 71 | <pre class="literalblock"> |
| 72 | Encapsulates a single HTTP request. |
| 73 | |
| 74 | </pre> |
| 75 | |
| 76 | <!-- ==================== INSTANCE METHODS ==================== --> |
| 77 | <a name="section-InstanceMethods"></a> |
| 78 | <table class="summary" border="1" cellpadding="3" |
| 79 | cellspacing="0" width="100%" bgcolor="white"> |
| 80 | <tr bgcolor="#70b0f0" class="table-header"> |
| 81 | <td colspan="2" class="table-header"> |
| 82 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 83 | <tr valign="top"> |
| 84 | <td align="left"><span class="table-header">Instance Methods</span></td> |
| 85 | <td align="right" valign="top" |
| 86 | ><span class="options">[<a href="#section-InstanceMethods" |
| 87 | class="privatelink" onclick="toggle_private();" |
| 88 | >hide private</a>]</span></td> |
| 89 | </tr> |
| 90 | </table> |
| 91 | </td> |
| 92 | </tr> |
| 93 | <tr> |
| 94 | <td width="15%" align="right" valign="top" class="summary"> |
| 95 | <span class="summary-type"> </span> |
| 96 | </td><td class="summary"> |
| 97 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 98 | <tr> |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 99 | <td><span class="summary-sig"><a href="apiclient.http.HttpRequest-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, |
| 100 | <span class="summary-sig-arg">http</span>, |
| 101 | <span class="summary-sig-arg">postproc</span>, |
| 102 | <span class="summary-sig-arg">uri</span>, |
| 103 | <span class="summary-sig-arg">method</span>=<span class="summary-sig-default">'GET'</span>, |
| 104 | <span class="summary-sig-arg">body</span>=<span class="summary-sig-default">None</span>, |
| 105 | <span class="summary-sig-arg">headers</span>=<span class="summary-sig-default">None</span>, |
| 106 | <span class="summary-sig-arg">methodId</span>=<span class="summary-sig-default">None</span>, |
| 107 | <span class="summary-sig-arg">resumable</span>=<span class="summary-sig-default">None</span>)</span><br /> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 108 | Constructor for an HttpRequest.</td> |
| 109 | <td align="right" valign="top"> |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 110 | <span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest.__init__">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 111 | |
| 112 | </td> |
| 113 | </tr> |
| 114 | </table> |
| 115 | |
| 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> |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 124 | <td><span class="summary-sig"><a href="apiclient.http.HttpRequest-class.html#execute" class="summary-sig-name">execute</a>(<span class="summary-sig-arg">self</span>, |
Joe Gregorio | 37802c3 | 2013-08-06 12:24:05 -0400 | [diff] [blame] | 125 | <span class="summary-sig-arg">http</span>=<span class="summary-sig-default">None</span>, |
| 126 | <span class="summary-sig-arg">num_retries</span>=<span class="summary-sig-default">0</span>)</span><br /> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 127 | Execute the request.</td> |
| 128 | <td align="right" valign="top"> |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 129 | <span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest.execute">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 130 | |
| 131 | </td> |
| 132 | </tr> |
| 133 | </table> |
| 134 | |
| 135 | </td> |
| 136 | </tr> |
| 137 | <tr> |
| 138 | <td width="15%" align="right" valign="top" class="summary"> |
| 139 | <span class="summary-type"> </span> |
| 140 | </td><td class="summary"> |
| 141 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 142 | <tr> |
Joe Gregorio | 52a5c53 | 2013-01-24 16:19:07 -0500 | [diff] [blame] | 143 | <td><span class="summary-sig"><a href="apiclient.http.HttpRequest-class.html#add_response_callback" class="summary-sig-name">add_response_callback</a>(<span class="summary-sig-arg">self</span>, |
| 144 | <span class="summary-sig-arg">cb</span>)</span><br /> |
| 145 | add_response_headers_callback</td> |
| 146 | <td align="right" valign="top"> |
| 147 | <span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest.add_response_callback">source code</a></span> |
| 148 | |
| 149 | </td> |
| 150 | </tr> |
| 151 | </table> |
| 152 | |
| 153 | </td> |
| 154 | </tr> |
| 155 | <tr> |
| 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> |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 161 | <td><span class="summary-sig"><a href="apiclient.http.HttpRequest-class.html#next_chunk" class="summary-sig-name">next_chunk</a>(<span class="summary-sig-arg">self</span>, |
Joe Gregorio | 37802c3 | 2013-08-06 12:24:05 -0400 | [diff] [blame] | 162 | <span class="summary-sig-arg">http</span>=<span class="summary-sig-default">None</span>, |
| 163 | <span class="summary-sig-arg">num_retries</span>=<span class="summary-sig-default">0</span>)</span><br /> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 164 | Execute the next step of a resumable upload.</td> |
| 165 | <td align="right" valign="top"> |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 166 | <span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest.next_chunk">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 167 | |
| 168 | </td> |
| 169 | </tr> |
| 170 | </table> |
| 171 | |
| 172 | </td> |
| 173 | </tr> |
Joe Gregorio | 6621203 | 2012-06-14 09:10:14 -0400 | [diff] [blame] | 174 | <tr class="private"> |
| 175 | <td width="15%" align="right" valign="top" class="summary"> |
| 176 | <span class="summary-type"> </span> |
| 177 | </td><td class="summary"> |
| 178 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 179 | <tr> |
| 180 | <td><span class="summary-sig"><a href="apiclient.http.HttpRequest-class.html#_process_response" class="summary-sig-name" onclick="show_private();">_process_response</a>(<span class="summary-sig-arg">self</span>, |
| 181 | <span class="summary-sig-arg">resp</span>, |
| 182 | <span class="summary-sig-arg">content</span>)</span><br /> |
| 183 | Process the response from a single chunk upload.</td> |
| 184 | <td align="right" valign="top"> |
| 185 | <span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest._process_response">source code</a></span> |
| 186 | |
| 187 | </td> |
| 188 | </tr> |
| 189 | </table> |
| 190 | |
| 191 | </td> |
| 192 | </tr> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 193 | <tr> |
| 194 | <td width="15%" align="right" valign="top" class="summary"> |
| 195 | <span class="summary-type"> </span> |
| 196 | </td><td class="summary"> |
| 197 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 198 | <tr> |
| 199 | <td><span class="summary-sig"><a name="to_json"></a><span class="summary-sig-name">to_json</span>(<span class="summary-sig-arg">self</span>)</span><br /> |
| 200 | Returns a JSON representation of the HttpRequest.</td> |
| 201 | <td align="right" valign="top"> |
| 202 | <span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest.to_json">source code</a></span> |
| 203 | |
| 204 | </td> |
| 205 | </tr> |
| 206 | </table> |
| 207 | |
| 208 | </td> |
| 209 | </tr> |
| 210 | <tr> |
| 211 | <td colspan="2" class="summary"> |
| 212 | <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| 213 | <code>__delattr__</code>, |
| 214 | <code>__format__</code>, |
| 215 | <code>__getattribute__</code>, |
| 216 | <code>__hash__</code>, |
| 217 | <code>__new__</code>, |
| 218 | <code>__reduce__</code>, |
| 219 | <code>__reduce_ex__</code>, |
| 220 | <code>__repr__</code>, |
| 221 | <code>__setattr__</code>, |
| 222 | <code>__sizeof__</code>, |
| 223 | <code>__str__</code>, |
| 224 | <code>__subclasshook__</code> |
| 225 | </p> |
| 226 | </td> |
| 227 | </tr> |
| 228 | </table> |
| 229 | <!-- ==================== STATIC METHODS ==================== --> |
| 230 | <a name="section-StaticMethods"></a> |
| 231 | <table class="summary" border="1" cellpadding="3" |
| 232 | cellspacing="0" width="100%" bgcolor="white"> |
| 233 | <tr bgcolor="#70b0f0" class="table-header"> |
| 234 | <td colspan="2" class="table-header"> |
| 235 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 236 | <tr valign="top"> |
| 237 | <td align="left"><span class="table-header">Static Methods</span></td> |
| 238 | <td align="right" valign="top" |
| 239 | ><span class="options">[<a href="#section-StaticMethods" |
| 240 | class="privatelink" onclick="toggle_private();" |
| 241 | >hide private</a>]</span></td> |
| 242 | </tr> |
| 243 | </table> |
| 244 | </td> |
| 245 | </tr> |
| 246 | <tr> |
| 247 | <td width="15%" align="right" valign="top" class="summary"> |
| 248 | <span class="summary-type"> </span> |
| 249 | </td><td class="summary"> |
| 250 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 251 | <tr> |
| 252 | <td><span class="summary-sig"><a name="from_json"></a><span class="summary-sig-name">from_json</span>(<span class="summary-sig-arg">s</span>, |
| 253 | <span class="summary-sig-arg">http</span>, |
| 254 | <span class="summary-sig-arg">postproc</span>)</span><br /> |
| 255 | Returns an HttpRequest populated with info from a JSON object.</td> |
| 256 | <td align="right" valign="top"> |
| 257 | <span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest.from_json">source code</a></span> |
| 258 | |
| 259 | </td> |
| 260 | </tr> |
| 261 | </table> |
| 262 | |
| 263 | </td> |
| 264 | </tr> |
| 265 | </table> |
| 266 | <!-- ==================== PROPERTIES ==================== --> |
| 267 | <a name="section-Properties"></a> |
| 268 | <table class="summary" border="1" cellpadding="3" |
| 269 | cellspacing="0" width="100%" bgcolor="white"> |
| 270 | <tr bgcolor="#70b0f0" class="table-header"> |
| 271 | <td colspan="2" class="table-header"> |
| 272 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 273 | <tr valign="top"> |
| 274 | <td align="left"><span class="table-header">Properties</span></td> |
| 275 | <td align="right" valign="top" |
| 276 | ><span class="options">[<a href="#section-Properties" |
| 277 | class="privatelink" onclick="toggle_private();" |
| 278 | >hide private</a>]</span></td> |
| 279 | </tr> |
| 280 | </table> |
| 281 | </td> |
| 282 | </tr> |
| 283 | <tr> |
| 284 | <td colspan="2" class="summary"> |
| 285 | <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| 286 | <code>__class__</code> |
| 287 | </p> |
| 288 | </td> |
| 289 | </tr> |
| 290 | </table> |
| 291 | <!-- ==================== METHOD DETAILS ==================== --> |
| 292 | <a name="section-MethodDetails"></a> |
| 293 | <table class="details" border="1" cellpadding="3" |
| 294 | cellspacing="0" width="100%" bgcolor="white"> |
| 295 | <tr bgcolor="#70b0f0" class="table-header"> |
| 296 | <td colspan="2" class="table-header"> |
| 297 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 298 | <tr valign="top"> |
| 299 | <td align="left"><span class="table-header">Method Details</span></td> |
| 300 | <td align="right" valign="top" |
| 301 | ><span class="options">[<a href="#section-MethodDetails" |
| 302 | class="privatelink" onclick="toggle_private();" |
| 303 | >hide private</a>]</span></td> |
| 304 | </tr> |
| 305 | </table> |
| 306 | </td> |
| 307 | </tr> |
| 308 | </table> |
| 309 | <a name="__init__"></a> |
| 310 | <div> |
| 311 | <table class="details" border="1" cellpadding="3" |
| 312 | cellspacing="0" width="100%" bgcolor="white"> |
| 313 | <tr><td> |
| 314 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 315 | <tr valign="top"><td> |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 316 | <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>, |
| 317 | <span class="sig-arg">http</span>, |
| 318 | <span class="sig-arg">postproc</span>, |
| 319 | <span class="sig-arg">uri</span>, |
| 320 | <span class="sig-arg">method</span>=<span class="sig-default">'GET'</span>, |
| 321 | <span class="sig-arg">body</span>=<span class="sig-default">None</span>, |
| 322 | <span class="sig-arg">headers</span>=<span class="sig-default">None</span>, |
| 323 | <span class="sig-arg">methodId</span>=<span class="sig-default">None</span>, |
| 324 | <span class="sig-arg">resumable</span>=<span class="sig-default">None</span>)</span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 325 | <br /><em class="fname">(Constructor)</em> |
| 326 | </h3> |
| 327 | </td><td align="right" valign="top" |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 328 | ><span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest.__init__">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 329 | </td> |
| 330 | </tr></table> |
| 331 | |
| 332 | <pre class="literalblock"> |
| 333 | Constructor for an HttpRequest. |
| 334 | |
| 335 | Args: |
| 336 | http: httplib2.Http, the transport object to use to make a request |
| 337 | postproc: callable, called on the HTTP response and content to transform |
| 338 | it into a data object before returning, or raising an exception |
| 339 | on an error. |
| 340 | uri: string, the absolute URI to send the request to |
| 341 | method: string, the HTTP method to use |
| 342 | body: string, the request body of the HTTP request, |
| 343 | headers: dict, the HTTP request headers |
| 344 | methodId: string, a unique identifier for the API method being called. |
| 345 | resumable: MediaUpload, None if this is not a resumbale request. |
| 346 | |
| 347 | </pre> |
| 348 | <dl class="fields"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame] | 349 | <dt>Decorators:</dt> |
| 350 | <dd><ul class="nomargin-top"> |
| 351 | <li><code>@util.positional(4)</code></li> |
| 352 | </ul></dd> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 353 | <dt>Overrides: |
| 354 | object.__init__ |
| 355 | </dt> |
| 356 | </dl> |
| 357 | </td></tr></table> |
| 358 | </div> |
| 359 | <a name="execute"></a> |
| 360 | <div> |
| 361 | <table class="details" border="1" cellpadding="3" |
| 362 | cellspacing="0" width="100%" bgcolor="white"> |
| 363 | <tr><td> |
| 364 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 365 | <tr valign="top"><td> |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 366 | <h3 class="epydoc"><span class="sig"><span class="sig-name">execute</span>(<span class="sig-arg">self</span>, |
Joe Gregorio | 37802c3 | 2013-08-06 12:24:05 -0400 | [diff] [blame] | 367 | <span class="sig-arg">http</span>=<span class="sig-default">None</span>, |
| 368 | <span class="sig-arg">num_retries</span>=<span class="sig-default">0</span>)</span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 369 | </h3> |
| 370 | </td><td align="right" valign="top" |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 371 | ><span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest.execute">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 372 | </td> |
| 373 | </tr></table> |
| 374 | |
| 375 | <pre class="literalblock"> |
| 376 | Execute the request. |
| 377 | |
| 378 | Args: |
| 379 | http: httplib2.Http, an http object to be used in place of the |
| 380 | one the HttpRequest request object was constructed with. |
Joe Gregorio | 37802c3 | 2013-08-06 12:24:05 -0400 | [diff] [blame] | 381 | num_retries: Integer, number of times to retry 500's with randomized |
| 382 | exponential backoff. If all retries fail, the raised HttpError |
| 383 | represents the last request. If zero (default), we attempt the |
| 384 | request only once. |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 385 | |
| 386 | Returns: |
| 387 | A deserialized object model of the response body as determined |
| 388 | by the postproc. |
| 389 | |
| 390 | Raises: |
| 391 | apiclient.errors.HttpError if the response was not a 2xx. |
Joe Gregorio | ad8013f | 2012-08-03 08:44:02 -0400 | [diff] [blame] | 392 | httplib2.HttpLib2Error if a transport error has occured. |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 393 | |
| 394 | </pre> |
| 395 | <dl class="fields"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame] | 396 | <dt>Decorators:</dt> |
| 397 | <dd><ul class="nomargin-top"> |
| 398 | <li><code>@util.positional(1)</code></li> |
| 399 | </ul></dd> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 400 | </dl> |
| 401 | </td></tr></table> |
| 402 | </div> |
Joe Gregorio | 52a5c53 | 2013-01-24 16:19:07 -0500 | [diff] [blame] | 403 | <a name="add_response_callback"></a> |
| 404 | <div> |
| 405 | <table class="details" border="1" cellpadding="3" |
| 406 | cellspacing="0" width="100%" bgcolor="white"> |
| 407 | <tr><td> |
| 408 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 409 | <tr valign="top"><td> |
| 410 | <h3 class="epydoc"><span class="sig"><span class="sig-name">add_response_callback</span>(<span class="sig-arg">self</span>, |
| 411 | <span class="sig-arg">cb</span>)</span> |
| 412 | </h3> |
| 413 | </td><td align="right" valign="top" |
| 414 | ><span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest.add_response_callback">source code</a></span> |
| 415 | </td> |
| 416 | </tr></table> |
| 417 | |
| 418 | <pre class="literalblock"> |
| 419 | add_response_headers_callback |
| 420 | |
| 421 | Args: |
| 422 | cb: Callback to be called on receiving the response headers, of signature: |
| 423 | |
| 424 | def cb(resp): |
| 425 | # Where resp is an instance of httplib2.Response |
| 426 | |
| 427 | </pre> |
| 428 | <dl class="fields"> |
| 429 | <dt>Decorators:</dt> |
| 430 | <dd><ul class="nomargin-top"> |
| 431 | <li><code>@util.positional(2)</code></li> |
| 432 | </ul></dd> |
| 433 | </dl> |
| 434 | </td></tr></table> |
| 435 | </div> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 436 | <a name="next_chunk"></a> |
| 437 | <div> |
| 438 | <table class="details" border="1" cellpadding="3" |
| 439 | cellspacing="0" width="100%" bgcolor="white"> |
| 440 | <tr><td> |
| 441 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 442 | <tr valign="top"><td> |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 443 | <h3 class="epydoc"><span class="sig"><span class="sig-name">next_chunk</span>(<span class="sig-arg">self</span>, |
Joe Gregorio | 37802c3 | 2013-08-06 12:24:05 -0400 | [diff] [blame] | 444 | <span class="sig-arg">http</span>=<span class="sig-default">None</span>, |
| 445 | <span class="sig-arg">num_retries</span>=<span class="sig-default">0</span>)</span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 446 | </h3> |
| 447 | </td><td align="right" valign="top" |
Joe Gregorio | f4839b0 | 2012-09-06 13:47:24 -0400 | [diff] [blame] | 448 | ><span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest.next_chunk">source code</a></span> |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 449 | </td> |
| 450 | </tr></table> |
| 451 | |
| 452 | <pre class="literalblock"> |
| 453 | Execute the next step of a resumable upload. |
| 454 | |
| 455 | Can only be used if the method being executed supports media uploads and |
| 456 | the MediaUpload object passed in was flagged as using resumable upload. |
| 457 | |
| 458 | Example: |
| 459 | |
Joe Gregorio | ebd0b84 | 2012-06-15 14:14:17 -0400 | [diff] [blame] | 460 | media = MediaFileUpload('cow.png', mimetype='image/png', |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 461 | chunksize=1000, resumable=True) |
Joe Gregorio | ebd0b84 | 2012-06-15 14:14:17 -0400 | [diff] [blame] | 462 | request = farm.animals().insert( |
| 463 | id='cow', |
| 464 | name='cow.png', |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 465 | media_body=media) |
| 466 | |
| 467 | response = None |
| 468 | while response is None: |
| 469 | status, response = request.next_chunk() |
| 470 | if status: |
| 471 | print "Upload %d%% complete." % int(status.progress() * 100) |
| 472 | |
| 473 | |
Joe Gregorio | 37802c3 | 2013-08-06 12:24:05 -0400 | [diff] [blame] | 474 | Args: |
| 475 | http: httplib2.Http, an http object to be used in place of the |
| 476 | one the HttpRequest request object was constructed with. |
| 477 | num_retries: Integer, number of times to retry 500's with randomized |
| 478 | exponential backoff. If all retries fail, the raised HttpError |
| 479 | represents the last request. If zero (default), we attempt the |
| 480 | request only once. |
| 481 | |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 482 | Returns: |
| 483 | (status, body): (ResumableMediaStatus, object) |
| 484 | The body will be None until the resumable media is fully uploaded. |
| 485 | |
Joe Gregorio | 6621203 | 2012-06-14 09:10:14 -0400 | [diff] [blame] | 486 | Raises: |
| 487 | apiclient.errors.HttpError if the response was not a 2xx. |
Joe Gregorio | ad8013f | 2012-08-03 08:44:02 -0400 | [diff] [blame] | 488 | httplib2.HttpLib2Error if a transport error has occured. |
Joe Gregorio | 6621203 | 2012-06-14 09:10:14 -0400 | [diff] [blame] | 489 | |
| 490 | </pre> |
| 491 | <dl class="fields"> |
Joe Gregorio | 1b425aa | 2012-08-24 12:04:34 -0400 | [diff] [blame] | 492 | <dt>Decorators:</dt> |
| 493 | <dd><ul class="nomargin-top"> |
| 494 | <li><code>@util.positional(1)</code></li> |
| 495 | </ul></dd> |
Joe Gregorio | 6621203 | 2012-06-14 09:10:14 -0400 | [diff] [blame] | 496 | </dl> |
| 497 | </td></tr></table> |
| 498 | </div> |
| 499 | <a name="_process_response"></a> |
| 500 | <div class="private"> |
| 501 | <table class="details" border="1" cellpadding="3" |
| 502 | cellspacing="0" width="100%" bgcolor="white"> |
| 503 | <tr><td> |
| 504 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 505 | <tr valign="top"><td> |
| 506 | <h3 class="epydoc"><span class="sig"><span class="sig-name">_process_response</span>(<span class="sig-arg">self</span>, |
| 507 | <span class="sig-arg">resp</span>, |
| 508 | <span class="sig-arg">content</span>)</span> |
| 509 | </h3> |
| 510 | </td><td align="right" valign="top" |
| 511 | ><span class="codelink"><a href="apiclient.http-pysrc.html#HttpRequest._process_response">source code</a></span> |
| 512 | </td> |
| 513 | </tr></table> |
| 514 | |
| 515 | <pre class="literalblock"> |
| 516 | Process the response from a single chunk upload. |
| 517 | |
| 518 | Args: |
| 519 | resp: httplib2.Response, the response object. |
| 520 | content: string, the content of the response. |
| 521 | |
| 522 | Returns: |
| 523 | (status, body): (ResumableMediaStatus, object) |
| 524 | The body will be None until the resumable media is fully uploaded. |
| 525 | |
| 526 | Raises: |
| 527 | apiclient.errors.HttpError if the response was not a 2xx or a 308. |
| 528 | |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 529 | </pre> |
| 530 | <dl class="fields"> |
| 531 | </dl> |
| 532 | </td></tr></table> |
| 533 | </div> |
| 534 | <br /> |
| 535 | <!-- ==================== NAVIGATION BAR ==================== --> |
| 536 | <table class="navbar" border="0" width="100%" cellpadding="0" |
| 537 | bgcolor="#a0c0ff" cellspacing="0"> |
| 538 | <tr valign="middle"> |
| 539 | |
| 540 | <!-- Tree link --> |
| 541 | <th> <a |
| 542 | href="module-tree.html">Trees</a> </th> |
| 543 | |
| 544 | <!-- Index link --> |
| 545 | <th> <a |
| 546 | href="identifier-index.html">Indices</a> </th> |
| 547 | |
| 548 | <!-- Help link --> |
| 549 | <th> <a |
| 550 | href="help.html">Help</a> </th> |
| 551 | |
| 552 | <th class="navbar" width="100%"></th> |
| 553 | </tr> |
| 554 | </table> |
| 555 | <table border="0" cellpadding="0" cellspacing="0" width="100%%"> |
| 556 | <tr> |
| 557 | <td align="left" class="footer"> |
Joe Gregorio | 37802c3 | 2013-08-06 12:24:05 -0400 | [diff] [blame] | 558 | Generated by Epydoc 3.0.1 on Tue Aug 6 12:16:43 2013 |
Joe Gregorio | 5dc0f5c | 2012-06-05 13:34:31 -0400 | [diff] [blame] | 559 | </td> |
| 560 | <td align="right" class="footer"> |
| 561 | <a target="mainFrame" href="http://epydoc.sourceforge.net" |
| 562 | >http://epydoc.sourceforge.net</a> |
| 563 | </td> |
| 564 | </tr> |
| 565 | </table> |
| 566 | |
| 567 | <script type="text/javascript"> |
| 568 | <!-- |
| 569 | // Private objects are initially displayed (because if |
| 570 | // javascript is turned off then we want them to be |
| 571 | // visible); but by default, we want to hide them. So hide |
| 572 | // them unless we have a cookie that says to show them. |
| 573 | checkCookie(); |
| 574 | // --> |
| 575 | </script> |
| 576 | </body> |
| 577 | </html> |