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.MediaUpload</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 MediaUpload 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.MediaUpload-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 MediaUpload</h1><p class="nomargin-top"><span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload">source code</a></span></p> 60<center> 61<center> <map id="uml_class_diagram_for_googleap_34" name="uml_class_diagram_for_googleap_34"> 62<area shape="rect" id="node1_9" href="googleapiclient.http.MediaUpload-class.html#chunksize" title="Chunk size for resumable uploads." alt="" coords="18,37,171,57"/> 63<area shape="rect" id="node1_10" href="googleapiclient.http.MediaUpload-class.html#mimetype" title="Mime type of the body." alt="" coords="18,57,171,77"/> 64<area shape="rect" id="node1_11" href="googleapiclient.http.MediaUpload-class.html#size" title="Size of upload." alt="" coords="18,77,171,97"/> 65<area shape="rect" id="node1_12" href="googleapiclient.http.MediaUpload-class.html#resumable" title="Whether this upload is resumable." alt="" coords="18,97,171,117"/> 66<area shape="rect" id="node1_13" href="googleapiclient.http.MediaUpload-class.html#getbytes" title="Get bytes from the media." alt="" coords="18,117,171,137"/> 67<area shape="rect" id="node1_14" href="googleapiclient.http.MediaUpload-class.html#has_stream" title="Does the underlying upload support a streaming interface." alt="" coords="18,137,171,157"/> 68<area shape="rect" id="node1_15" href="googleapiclient.http.MediaUpload-class.html#stream" title="A stream interface to the data being uploaded." alt="" coords="18,157,171,177"/> 69<area shape="rect" id="node1_16" href="googleapiclient.http.MediaUpload-class.html#to_json" title="Create a JSON representation of an instance of MediaUpload." alt="" coords="18,177,171,197"/> 70<area shape="rect" id="node1_17" href="googleapiclient.http.MediaUpload-class.html#new_from_json" title="Utility class method to instantiate a MediaUpload subclass from a JSON representation produced by to_json()." alt="" coords="18,197,171,217"/> 71<area shape="rect" id="node1" href="googleapiclient.http.MediaUpload-class.html" title="Describes a media object to upload." alt="" coords="5,5,183,224"/> 72</map> 73 <img src="uml_class_diagram_for_googleap_34.gif" alt='' usemap="#uml_class_diagram_for_googleap_34" ismap="ismap" class="graph-without-title" /> 74</center> 75</center> 76<hr /> 77<pre class="literalblock"> 78Describes a media object to upload. 79 80Base class that defines the interface of MediaUpload subclasses. 81 82Note that subclasses of MediaUpload may allow you to control the chunksize 83when uploading a media object. It is important to keep the size of the chunk 84as large as possible to keep the upload efficient. Other factors may influence 85the size of the chunk you use, particularly if you are working in an 86environment where individual HTTP requests may have a hardcoded time limit, 87such as under certain classes of requests under Google App Engine. 88 89Streams are io.Base compatible objects that support seek(). Some MediaUpload 90subclasses support using streams directly to upload data. Support for 91streaming may be indicated by a MediaUpload sub-class and if appropriate for a 92platform that stream will be used for uploading the media object. The support 93for streaming is indicated by has_stream() returning True. The stream() method 94should return an io.Base object that supports seek(). On platforms where the 95underlying httplib module supports streaming, for example Python 2.6 and 96later, the stream will be passed into the http library which will result in 97less memory being used and possibly faster uploads. 98 99If you need to upload media that can't be uploaded using any of the existing 100MediaUpload sub-class then you can sub-class MediaUpload for your particular 101needs. 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.MediaUpload-class.html#chunksize" class="summary-sig-name">chunksize</a>(<span class="summary-sig-arg">self</span>)</span><br /> 129 Chunk size for resumable uploads.</td> 130 <td align="right" valign="top"> 131 <span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.chunksize">source code</a></span> 132 133 </td> 134 </tr> 135 </table> 136 137 </td> 138 </tr> 139<tr> 140 <td width="15%" align="right" valign="top" class="summary"> 141 <span class="summary-type"> </span> 142 </td><td class="summary"> 143 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 144 <tr> 145 <td><span class="summary-sig"><a href="googleapiclient.http.MediaUpload-class.html#mimetype" class="summary-sig-name">mimetype</a>(<span class="summary-sig-arg">self</span>)</span><br /> 146 Mime type of the body.</td> 147 <td align="right" valign="top"> 148 <span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.mimetype">source code</a></span> 149 150 </td> 151 </tr> 152 </table> 153 154 </td> 155 </tr> 156<tr> 157 <td width="15%" align="right" valign="top" class="summary"> 158 <span class="summary-type"> </span> 159 </td><td class="summary"> 160 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 161 <tr> 162 <td><span class="summary-sig"><a href="googleapiclient.http.MediaUpload-class.html#size" class="summary-sig-name">size</a>(<span class="summary-sig-arg">self</span>)</span><br /> 163 Size of upload.</td> 164 <td align="right" valign="top"> 165 <span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.size">source code</a></span> 166 167 </td> 168 </tr> 169 </table> 170 171 </td> 172 </tr> 173<tr> 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.MediaUpload-class.html#resumable" class="summary-sig-name">resumable</a>(<span class="summary-sig-arg">self</span>)</span><br /> 180 Whether this upload is resumable.</td> 181 <td align="right" valign="top"> 182 <span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.resumable">source code</a></span> 183 184 </td> 185 </tr> 186 </table> 187 188 </td> 189 </tr> 190<tr> 191 <td width="15%" align="right" valign="top" class="summary"> 192 <span class="summary-type"> </span> 193 </td><td class="summary"> 194 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 195 <tr> 196 <td><span class="summary-sig"><a href="googleapiclient.http.MediaUpload-class.html#getbytes" class="summary-sig-name">getbytes</a>(<span class="summary-sig-arg">self</span>, 197 <span class="summary-sig-arg">begin</span>, 198 <span class="summary-sig-arg">end</span>)</span><br /> 199 Get bytes from the media.</td> 200 <td align="right" valign="top"> 201 <span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.getbytes">source code</a></span> 202 203 </td> 204 </tr> 205 </table> 206 207 </td> 208 </tr> 209<tr> 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.MediaUpload-class.html#has_stream" class="summary-sig-name">has_stream</a>(<span class="summary-sig-arg">self</span>)</span><br /> 216 Does the underlying upload support a streaming interface.</td> 217 <td align="right" valign="top"> 218 <span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.has_stream">source code</a></span> 219 220 </td> 221 </tr> 222 </table> 223 224 </td> 225 </tr> 226<tr> 227 <td width="15%" align="right" valign="top" class="summary"> 228 <span class="summary-type"> </span> 229 </td><td class="summary"> 230 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 231 <tr> 232 <td><span class="summary-sig"><a href="googleapiclient.http.MediaUpload-class.html#stream" class="summary-sig-name">stream</a>(<span class="summary-sig-arg">self</span>)</span><br /> 233 A stream interface to the data being uploaded.</td> 234 <td align="right" valign="top"> 235 <span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.stream">source code</a></span> 236 237 </td> 238 </tr> 239 </table> 240 241 </td> 242 </tr> 243<tr class="private"> 244 <td width="15%" align="right" valign="top" class="summary"> 245 <span class="summary-type"> </span> 246 </td><td class="summary"> 247 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 248 <tr> 249 <td><span class="summary-sig"><a href="googleapiclient.http.MediaUpload-class.html#_to_json" class="summary-sig-name" onclick="show_private();">_to_json</a>(<span class="summary-sig-arg">self</span>, 250 <span class="summary-sig-arg">strip</span>=<span class="summary-sig-default">None</span>)</span><br /> 251 Utility function for creating a JSON representation of a MediaUpload.</td> 252 <td align="right" valign="top"> 253 <span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload._to_json">source code</a></span> 254 255 </td> 256 </tr> 257 </table> 258 259 </td> 260 </tr> 261<tr> 262 <td width="15%" align="right" valign="top" class="summary"> 263 <span class="summary-type"> </span> 264 </td><td class="summary"> 265 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 266 <tr> 267 <td><span class="summary-sig"><a href="googleapiclient.http.MediaUpload-class.html#to_json" class="summary-sig-name">to_json</a>(<span class="summary-sig-arg">self</span>)</span><br /> 268 Create a JSON representation of an instance of MediaUpload.</td> 269 <td align="right" valign="top"> 270 <span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.to_json">source code</a></span> 271 272 </td> 273 </tr> 274 </table> 275 276 </td> 277 </tr> 278 <tr> 279 <td colspan="2" class="summary"> 280 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: 281 <code>__delattr__</code>, 282 <code>__format__</code>, 283 <code>__getattribute__</code>, 284 <code>__hash__</code>, 285 <code>__init__</code>, 286 <code>__new__</code>, 287 <code>__reduce__</code>, 288 <code>__reduce_ex__</code>, 289 <code>__repr__</code>, 290 <code>__setattr__</code>, 291 <code>__sizeof__</code>, 292 <code>__str__</code>, 293 <code>__subclasshook__</code> 294 </p> 295 </td> 296 </tr> 297</table> 298<!-- ==================== CLASS METHODS ==================== --> 299<a name="section-ClassMethods"></a> 300<table class="summary" border="1" cellpadding="3" 301 cellspacing="0" width="100%" bgcolor="white"> 302<tr bgcolor="#70b0f0" class="table-header"> 303 <td colspan="2" class="table-header"> 304 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 305 <tr valign="top"> 306 <td align="left"><span class="table-header">Class Methods</span></td> 307 <td align="right" valign="top" 308 ><span class="options">[<a href="#section-ClassMethods" 309 class="privatelink" onclick="toggle_private();" 310 >hide private</a>]</span></td> 311 </tr> 312 </table> 313 </td> 314</tr> 315<tr> 316 <td width="15%" align="right" valign="top" class="summary"> 317 <span class="summary-type"> </span> 318 </td><td class="summary"> 319 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 320 <tr> 321 <td><span class="summary-sig"><a href="googleapiclient.http.MediaUpload-class.html#new_from_json" class="summary-sig-name">new_from_json</a>(<span class="summary-sig-arg">cls</span>, 322 <span class="summary-sig-arg">s</span>)</span><br /> 323 Utility class method to instantiate a MediaUpload subclass from a JSON 324representation produced by to_json().</td> 325 <td align="right" valign="top"> 326 <span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.new_from_json">source code</a></span> 327 328 </td> 329 </tr> 330 </table> 331 332 </td> 333 </tr> 334</table> 335<!-- ==================== PROPERTIES ==================== --> 336<a name="section-Properties"></a> 337<table class="summary" border="1" cellpadding="3" 338 cellspacing="0" width="100%" bgcolor="white"> 339<tr bgcolor="#70b0f0" class="table-header"> 340 <td colspan="2" class="table-header"> 341 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 342 <tr valign="top"> 343 <td align="left"><span class="table-header">Properties</span></td> 344 <td align="right" valign="top" 345 ><span class="options">[<a href="#section-Properties" 346 class="privatelink" onclick="toggle_private();" 347 >hide private</a>]</span></td> 348 </tr> 349 </table> 350 </td> 351</tr> 352 <tr> 353 <td colspan="2" class="summary"> 354 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: 355 <code>__class__</code> 356 </p> 357 </td> 358 </tr> 359</table> 360<!-- ==================== METHOD DETAILS ==================== --> 361<a name="section-MethodDetails"></a> 362<table class="details" border="1" cellpadding="3" 363 cellspacing="0" width="100%" bgcolor="white"> 364<tr bgcolor="#70b0f0" class="table-header"> 365 <td colspan="2" class="table-header"> 366 <table border="0" cellpadding="0" cellspacing="0" width="100%"> 367 <tr valign="top"> 368 <td align="left"><span class="table-header">Method Details</span></td> 369 <td align="right" valign="top" 370 ><span class="options">[<a href="#section-MethodDetails" 371 class="privatelink" onclick="toggle_private();" 372 >hide private</a>]</span></td> 373 </tr> 374 </table> 375 </td> 376</tr> 377</table> 378<a name="chunksize"></a> 379<div> 380<table class="details" border="1" cellpadding="3" 381 cellspacing="0" width="100%" bgcolor="white"> 382<tr><td> 383 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 384 <tr valign="top"><td> 385 <h3 class="epydoc"><span class="sig"><span class="sig-name">chunksize</span>(<span class="sig-arg">self</span>)</span> 386 </h3> 387 </td><td align="right" valign="top" 388 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.chunksize">source code</a></span> 389 </td> 390 </tr></table> 391 392 <pre class="literalblock"> 393Chunk size for resumable uploads. 394 395Returns: 396 Chunk size in bytes. 397 398</pre> 399 <dl class="fields"> 400 </dl> 401</td></tr></table> 402</div> 403<a name="mimetype"></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">mimetype</span>(<span class="sig-arg">self</span>)</span> 411 </h3> 412 </td><td align="right" valign="top" 413 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.mimetype">source code</a></span> 414 </td> 415 </tr></table> 416 417 <pre class="literalblock"> 418Mime type of the body. 419 420Returns: 421 Mime type. 422 423</pre> 424 <dl class="fields"> 425 </dl> 426</td></tr></table> 427</div> 428<a name="size"></a> 429<div> 430<table class="details" border="1" cellpadding="3" 431 cellspacing="0" width="100%" bgcolor="white"> 432<tr><td> 433 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 434 <tr valign="top"><td> 435 <h3 class="epydoc"><span class="sig"><span class="sig-name">size</span>(<span class="sig-arg">self</span>)</span> 436 </h3> 437 </td><td align="right" valign="top" 438 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.size">source code</a></span> 439 </td> 440 </tr></table> 441 442 <pre class="literalblock"> 443Size of upload. 444 445Returns: 446 Size of the body, or None of the size is unknown. 447 448</pre> 449 <dl class="fields"> 450 </dl> 451</td></tr></table> 452</div> 453<a name="resumable"></a> 454<div> 455<table class="details" border="1" cellpadding="3" 456 cellspacing="0" width="100%" bgcolor="white"> 457<tr><td> 458 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 459 <tr valign="top"><td> 460 <h3 class="epydoc"><span class="sig"><span class="sig-name">resumable</span>(<span class="sig-arg">self</span>)</span> 461 </h3> 462 </td><td align="right" valign="top" 463 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.resumable">source code</a></span> 464 </td> 465 </tr></table> 466 467 <pre class="literalblock"> 468Whether this upload is resumable. 469 470Returns: 471 True if resumable upload or False. 472 473</pre> 474 <dl class="fields"> 475 </dl> 476</td></tr></table> 477</div> 478<a name="getbytes"></a> 479<div> 480<table class="details" border="1" cellpadding="3" 481 cellspacing="0" width="100%" bgcolor="white"> 482<tr><td> 483 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 484 <tr valign="top"><td> 485 <h3 class="epydoc"><span class="sig"><span class="sig-name">getbytes</span>(<span class="sig-arg">self</span>, 486 <span class="sig-arg">begin</span>, 487 <span class="sig-arg">end</span>)</span> 488 </h3> 489 </td><td align="right" valign="top" 490 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.getbytes">source code</a></span> 491 </td> 492 </tr></table> 493 494 <pre class="literalblock"> 495Get bytes from the media. 496 497Args: 498 begin: int, offset from beginning of file. 499 length: int, number of bytes to read, starting at begin. 500 501Returns: 502 A string of bytes read. May be shorter than length if EOF was reached 503 first. 504 505</pre> 506 <dl class="fields"> 507 </dl> 508</td></tr></table> 509</div> 510<a name="has_stream"></a> 511<div> 512<table class="details" border="1" cellpadding="3" 513 cellspacing="0" width="100%" bgcolor="white"> 514<tr><td> 515 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 516 <tr valign="top"><td> 517 <h3 class="epydoc"><span class="sig"><span class="sig-name">has_stream</span>(<span class="sig-arg">self</span>)</span> 518 </h3> 519 </td><td align="right" valign="top" 520 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.has_stream">source code</a></span> 521 </td> 522 </tr></table> 523 524 <pre class="literalblock"> 525Does the underlying upload support a streaming interface. 526 527Streaming means it is an io.IOBase subclass that supports seek, i.e. 528seekable() returns True. 529 530Returns: 531 True if the call to stream() will return an instance of a seekable io.Base 532 subclass. 533 534</pre> 535 <dl class="fields"> 536 </dl> 537</td></tr></table> 538</div> 539<a name="stream"></a> 540<div> 541<table class="details" border="1" cellpadding="3" 542 cellspacing="0" width="100%" bgcolor="white"> 543<tr><td> 544 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 545 <tr valign="top"><td> 546 <h3 class="epydoc"><span class="sig"><span class="sig-name">stream</span>(<span class="sig-arg">self</span>)</span> 547 </h3> 548 </td><td align="right" valign="top" 549 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.stream">source code</a></span> 550 </td> 551 </tr></table> 552 553 <pre class="literalblock"> 554A stream interface to the data being uploaded. 555 556Returns: 557 The returned value is an io.IOBase subclass that supports seek, i.e. 558 seekable() returns True. 559 560</pre> 561 <dl class="fields"> 562 </dl> 563</td></tr></table> 564</div> 565<a name="_to_json"></a> 566<div class="private"> 567<table class="details" border="1" cellpadding="3" 568 cellspacing="0" width="100%" bgcolor="white"> 569<tr><td> 570 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 571 <tr valign="top"><td> 572 <h3 class="epydoc"><span class="sig"><span class="sig-name">_to_json</span>(<span class="sig-arg">self</span>, 573 <span class="sig-arg">strip</span>=<span class="sig-default">None</span>)</span> 574 </h3> 575 </td><td align="right" valign="top" 576 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload._to_json">source code</a></span> 577 </td> 578 </tr></table> 579 580 <pre class="literalblock"> 581Utility function for creating a JSON representation of a MediaUpload. 582 583Args: 584 strip: array, An array of names of members to not include in the JSON. 585 586Returns: 587 string, a JSON representation of this instance, suitable to pass to 588 from_json(). 589 590</pre> 591 <dl class="fields"> 592 <dt>Decorators:</dt> 593 <dd><ul class="nomargin-top"> 594 <li><code>@util.positional(1)</code></li> 595 </ul></dd> 596 </dl> 597</td></tr></table> 598</div> 599<a name="to_json"></a> 600<div> 601<table class="details" border="1" cellpadding="3" 602 cellspacing="0" width="100%" bgcolor="white"> 603<tr><td> 604 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 605 <tr valign="top"><td> 606 <h3 class="epydoc"><span class="sig"><span class="sig-name">to_json</span>(<span class="sig-arg">self</span>)</span> 607 </h3> 608 </td><td align="right" valign="top" 609 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.to_json">source code</a></span> 610 </td> 611 </tr></table> 612 613 <pre class="literalblock"> 614Create a JSON representation of an instance of MediaUpload. 615 616Returns: 617 string, a JSON representation of this instance, suitable to pass to 618 from_json(). 619 620</pre> 621 <dl class="fields"> 622 </dl> 623</td></tr></table> 624</div> 625<a name="new_from_json"></a> 626<div> 627<table class="details" border="1" cellpadding="3" 628 cellspacing="0" width="100%" bgcolor="white"> 629<tr><td> 630 <table width="100%" cellpadding="0" cellspacing="0" border="0"> 631 <tr valign="top"><td> 632 <h3 class="epydoc"><span class="sig"><span class="sig-name">new_from_json</span>(<span class="sig-arg">cls</span>, 633 <span class="sig-arg">s</span>)</span> 634 <br /><em class="fname">Class Method</em> 635 </h3> 636 </td><td align="right" valign="top" 637 ><span class="codelink"><a href="googleapiclient.http-pysrc.html#MediaUpload.new_from_json">source code</a></span> 638 </td> 639 </tr></table> 640 641 <pre class="literalblock"> 642Utility class method to instantiate a MediaUpload subclass from a JSON 643representation produced by to_json(). 644 645Args: 646 s: string, JSON from to_json(). 647 648Returns: 649 An instance of the subclass of MediaUpload that was serialized with 650 to_json(). 651 652</pre> 653 <dl class="fields"> 654 </dl> 655</td></tr></table> 656</div> 657<br /> 658<!-- ==================== NAVIGATION BAR ==================== --> 659<table class="navbar" border="0" width="100%" cellpadding="0" 660 bgcolor="#a0c0ff" cellspacing="0"> 661 <tr valign="middle"> 662 <!-- Home link --> 663 <th> <a 664 href="googleapiclient-module.html">Home</a> </th> 665 666 <!-- Tree link --> 667 <th> <a 668 href="module-tree.html">Trees</a> </th> 669 670 <!-- Index link --> 671 <th> <a 672 href="identifier-index.html">Indices</a> </th> 673 674 <!-- Help link --> 675 <th> <a 676 href="help.html">Help</a> </th> 677 678 <th class="navbar" width="100%"></th> 679 </tr> 680</table> 681<table border="0" cellpadding="0" cellspacing="0" width="100%%"> 682 <tr> 683 <td align="left" class="footer"> 684 Generated by Epydoc 3.0.1 on Fri Jun 14 15:57:28 2019 685 </td> 686 <td align="right" class="footer"> 687 <a target="mainFrame" href="http://epydoc.sourceforge.net" 688 >http://epydoc.sourceforge.net</a> 689 </td> 690 </tr> 691</table> 692 693<script type="text/javascript"> 694 <!-- 695 // Private objects are initially displayed (because if 696 // javascript is turned off then we want them to be 697 // visible); but by default, we want to hide them. So hide 698 // them unless we have a cookie that says to show them. 699 checkCookie(); 700 // --> 701</script> 702</body> 703</html> 704