| <?xml version="1.0" encoding="ascii"?> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| <head> |
| <title>apiclient.http.MediaFileUpload</title> |
| <link rel="stylesheet" href="epydoc.css" type="text/css" /> |
| <script type="text/javascript" src="epydoc.js"></script> |
| </head> |
| |
| <body bgcolor="white" text="black" link="blue" vlink="#204080" |
| alink="#204080"> |
| <!-- ==================== NAVIGATION BAR ==================== --> |
| <table class="navbar" border="0" width="100%" cellpadding="0" |
| bgcolor="#a0c0ff" cellspacing="0"> |
| <tr valign="middle"> |
| |
| <!-- Tree link --> |
| <th> <a |
| href="module-tree.html">Trees</a> </th> |
| |
| <!-- Index link --> |
| <th> <a |
| href="identifier-index.html">Indices</a> </th> |
| |
| <!-- Help link --> |
| <th> <a |
| href="help.html">Help</a> </th> |
| |
| <th class="navbar" width="100%"></th> |
| </tr> |
| </table> |
| <table width="100%" cellpadding="0" cellspacing="0"> |
| <tr valign="top"> |
| <td width="100%"> |
| <span class="breadcrumbs"> |
| <a href="apiclient-module.html">Package apiclient</a> :: |
| <a href="apiclient.http-module.html">Module http</a> :: |
| Class MediaFileUpload |
| </span> |
| </td> |
| <td> |
| <table cellpadding="0" cellspacing="0"> |
| <!-- hide/show private --> |
| <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" |
| onclick="toggle_private();">hide private</a>]</span></td></tr> |
| <tr><td align="right"><span class="options" |
| >[<a href="frames.html" target="_top">frames</a |
| >] | <a href="apiclient.http.MediaFileUpload-class.html" |
| target="_top">no frames</a>]</span></td></tr> |
| </table> |
| </td> |
| </tr> |
| </table> |
| <!-- ==================== CLASS DESCRIPTION ==================== --> |
| <h1 class="epydoc">Class MediaFileUpload</h1><p class="nomargin-top"><span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload">source code</a></span></p> |
| <center> |
| <center> <map id="class_hierarchy_for_mediafileu" name="class_hierarchy_for_mediafileu"> |
| <area shape="rect" href="apiclient.http.MediaFileUpload-class.html" title="MediaFileUpload" alt="" coords="5,61,123,88"/> |
| <area shape="rect" href="apiclient.http.MediaUpload-class.html" title="MediaUpload" alt="" coords="16,5,112,32"/> |
| </map> |
| <img src="class_hierarchy_for_mediafileu.gif" alt='' usemap="#class_hierarchy_for_mediafileu" ismap="ismap" class="graph-without-title" /> |
| </center> |
| </center> |
| <hr /> |
| <pre class="literalblock"> |
| A MediaUpload for a file. |
| |
| Construct a MediaFileUpload and pass as the media_body parameter of the |
| method. For example, if we had a service that allowed uploading images: |
| |
| |
| media = MediaFileUpload('cow.png', mimetype='image/png', |
| chunksize=1024*1024, resumable=True) |
| farm.animals()..insert( |
| id='cow', |
| name='cow.png', |
| media_body=media).execute() |
| |
| </pre> |
| |
| <!-- ==================== INSTANCE METHODS ==================== --> |
| <a name="section-InstanceMethods"></a> |
| <table class="summary" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr bgcolor="#70b0f0" class="table-header"> |
| <td colspan="2" class="table-header"> |
| <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| <tr valign="top"> |
| <td align="left"><span class="table-header">Instance Methods</span></td> |
| <td align="right" valign="top" |
| ><span class="options">[<a href="#section-InstanceMethods" |
| class="privatelink" onclick="toggle_private();" |
| >hide private</a>]</span></td> |
| </tr> |
| </table> |
| </td> |
| </tr> |
| <tr> |
| <td width="15%" align="right" valign="top" class="summary"> |
| <span class="summary-type"> </span> |
| </td><td class="summary"> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr> |
| <td><span class="summary-sig"><a href="apiclient.http.MediaFileUpload-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, |
| <span class="summary-sig-arg">filename</span>, |
| <span class="summary-sig-arg">mimetype</span>=<span class="summary-sig-default">None</span>, |
| <span class="summary-sig-arg">chunksize</span>=<span class="summary-sig-default">524288</span>, |
| <span class="summary-sig-arg">resumable</span>=<span class="summary-sig-default">False</span>)</span><br /> |
| Constructor.</td> |
| <td align="right" valign="top"> |
| <span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.__init__">source code</a></span> |
| |
| </td> |
| </tr> |
| </table> |
| |
| </td> |
| </tr> |
| <tr> |
| <td width="15%" align="right" valign="top" class="summary"> |
| <span class="summary-type"> </span> |
| </td><td class="summary"> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr> |
| <td><span class="summary-sig"><a href="apiclient.http.MediaFileUpload-class.html#chunksize" class="summary-sig-name">chunksize</a>(<span class="summary-sig-arg">self</span>)</span><br /> |
| Chunk size for resumable uploads.</td> |
| <td align="right" valign="top"> |
| <span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.chunksize">source code</a></span> |
| |
| </td> |
| </tr> |
| </table> |
| |
| </td> |
| </tr> |
| <tr> |
| <td width="15%" align="right" valign="top" class="summary"> |
| <span class="summary-type"> </span> |
| </td><td class="summary"> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr> |
| <td><span class="summary-sig"><a href="apiclient.http.MediaFileUpload-class.html#mimetype" class="summary-sig-name">mimetype</a>(<span class="summary-sig-arg">self</span>)</span><br /> |
| Mime type of the body.</td> |
| <td align="right" valign="top"> |
| <span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.mimetype">source code</a></span> |
| |
| </td> |
| </tr> |
| </table> |
| |
| </td> |
| </tr> |
| <tr> |
| <td width="15%" align="right" valign="top" class="summary"> |
| <span class="summary-type"> </span> |
| </td><td class="summary"> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr> |
| <td><span class="summary-sig"><a href="apiclient.http.MediaFileUpload-class.html#size" class="summary-sig-name">size</a>(<span class="summary-sig-arg">self</span>)</span><br /> |
| Size of upload.</td> |
| <td align="right" valign="top"> |
| <span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.size">source code</a></span> |
| |
| </td> |
| </tr> |
| </table> |
| |
| </td> |
| </tr> |
| <tr> |
| <td width="15%" align="right" valign="top" class="summary"> |
| <span class="summary-type"> </span> |
| </td><td class="summary"> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr> |
| <td><span class="summary-sig"><a href="apiclient.http.MediaFileUpload-class.html#resumable" class="summary-sig-name">resumable</a>(<span class="summary-sig-arg">self</span>)</span><br /> |
| Whether this upload is resumable.</td> |
| <td align="right" valign="top"> |
| <span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.resumable">source code</a></span> |
| |
| </td> |
| </tr> |
| </table> |
| |
| </td> |
| </tr> |
| <tr> |
| <td width="15%" align="right" valign="top" class="summary"> |
| <span class="summary-type"> </span> |
| </td><td class="summary"> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr> |
| <td><span class="summary-sig"><a href="apiclient.http.MediaFileUpload-class.html#getbytes" class="summary-sig-name">getbytes</a>(<span class="summary-sig-arg">self</span>, |
| <span class="summary-sig-arg">begin</span>, |
| <span class="summary-sig-arg">length</span>)</span><br /> |
| Get bytes from the media.</td> |
| <td align="right" valign="top"> |
| <span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.getbytes">source code</a></span> |
| |
| </td> |
| </tr> |
| </table> |
| |
| </td> |
| </tr> |
| <tr> |
| <td width="15%" align="right" valign="top" class="summary"> |
| <span class="summary-type"> </span> |
| </td><td class="summary"> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr> |
| <td><span class="summary-sig"><a href="apiclient.http.MediaFileUpload-class.html#to_json" class="summary-sig-name">to_json</a>(<span class="summary-sig-arg">self</span>)</span><br /> |
| Creating a JSON representation of an instance of MediaFileUpload.</td> |
| <td align="right" valign="top"> |
| <span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.to_json">source code</a></span> |
| |
| </td> |
| </tr> |
| </table> |
| |
| </td> |
| </tr> |
| <tr> |
| <td colspan="2" class="summary"> |
| <div class="private"> <p class="indent-wrapped-lines"><b>Inherited from <code><a href="apiclient.http.MediaUpload-class.html">MediaUpload</a></code></b> (private): |
| <code><a href="apiclient.http.MediaUpload-class.html#_to_json" onclick="show_private();">_to_json</a></code> |
| </p></div> |
| <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| <code>__delattr__</code>, |
| <code>__format__</code>, |
| <code>__getattribute__</code>, |
| <code>__hash__</code>, |
| <code>__new__</code>, |
| <code>__reduce__</code>, |
| <code>__reduce_ex__</code>, |
| <code>__repr__</code>, |
| <code>__setattr__</code>, |
| <code>__sizeof__</code>, |
| <code>__str__</code>, |
| <code>__subclasshook__</code> |
| </p> |
| </td> |
| </tr> |
| </table> |
| <!-- ==================== CLASS METHODS ==================== --> |
| <a name="section-ClassMethods"></a> |
| <table class="summary" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr bgcolor="#70b0f0" class="table-header"> |
| <td colspan="2" class="table-header"> |
| <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| <tr valign="top"> |
| <td align="left"><span class="table-header">Class Methods</span></td> |
| <td align="right" valign="top" |
| ><span class="options">[<a href="#section-ClassMethods" |
| class="privatelink" onclick="toggle_private();" |
| >hide private</a>]</span></td> |
| </tr> |
| </table> |
| </td> |
| </tr> |
| <tr> |
| <td colspan="2" class="summary"> |
| <p class="indent-wrapped-lines"><b>Inherited from <code><a href="apiclient.http.MediaUpload-class.html">MediaUpload</a></code></b>: |
| <code><a href="apiclient.http.MediaUpload-class.html#new_from_json">new_from_json</a></code> |
| </p> |
| </td> |
| </tr> |
| </table> |
| <!-- ==================== STATIC METHODS ==================== --> |
| <a name="section-StaticMethods"></a> |
| <table class="summary" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr bgcolor="#70b0f0" class="table-header"> |
| <td colspan="2" class="table-header"> |
| <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| <tr valign="top"> |
| <td align="left"><span class="table-header">Static Methods</span></td> |
| <td align="right" valign="top" |
| ><span class="options">[<a href="#section-StaticMethods" |
| class="privatelink" onclick="toggle_private();" |
| >hide private</a>]</span></td> |
| </tr> |
| </table> |
| </td> |
| </tr> |
| <tr> |
| <td width="15%" align="right" valign="top" class="summary"> |
| <span class="summary-type"> </span> |
| </td><td class="summary"> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr> |
| <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>)</span></td> |
| <td align="right" valign="top"> |
| <span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.from_json">source code</a></span> |
| |
| </td> |
| </tr> |
| </table> |
| |
| </td> |
| </tr> |
| </table> |
| <!-- ==================== PROPERTIES ==================== --> |
| <a name="section-Properties"></a> |
| <table class="summary" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr bgcolor="#70b0f0" class="table-header"> |
| <td colspan="2" class="table-header"> |
| <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| <tr valign="top"> |
| <td align="left"><span class="table-header">Properties</span></td> |
| <td align="right" valign="top" |
| ><span class="options">[<a href="#section-Properties" |
| class="privatelink" onclick="toggle_private();" |
| >hide private</a>]</span></td> |
| </tr> |
| </table> |
| </td> |
| </tr> |
| <tr> |
| <td colspan="2" class="summary"> |
| <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| <code>__class__</code> |
| </p> |
| </td> |
| </tr> |
| </table> |
| <!-- ==================== METHOD DETAILS ==================== --> |
| <a name="section-MethodDetails"></a> |
| <table class="details" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr bgcolor="#70b0f0" class="table-header"> |
| <td colspan="2" class="table-header"> |
| <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| <tr valign="top"> |
| <td align="left"><span class="table-header">Method Details</span></td> |
| <td align="right" valign="top" |
| ><span class="options">[<a href="#section-MethodDetails" |
| class="privatelink" onclick="toggle_private();" |
| >hide private</a>]</span></td> |
| </tr> |
| </table> |
| </td> |
| </tr> |
| </table> |
| <a name="__init__"></a> |
| <div> |
| <table class="details" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr><td> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr valign="top"><td> |
| <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>, |
| <span class="sig-arg">filename</span>, |
| <span class="sig-arg">mimetype</span>=<span class="sig-default">None</span>, |
| <span class="sig-arg">chunksize</span>=<span class="sig-default">524288</span>, |
| <span class="sig-arg">resumable</span>=<span class="sig-default">False</span>)</span> |
| <br /><em class="fname">(Constructor)</em> |
| </h3> |
| </td><td align="right" valign="top" |
| ><span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.__init__">source code</a></span> |
| </td> |
| </tr></table> |
| |
| <pre class="literalblock"> |
| Constructor. |
| |
| Args: |
| filename: string, Name of the file. |
| mimetype: string, Mime-type of the file. If None then a mime-type will be |
| guessed from the file extension. |
| chunksize: int, File will be uploaded in chunks of this many bytes. Only |
| used if resumable=True. |
| resumable: bool, True if this is a resumable upload. False means upload |
| in a single request. |
| |
| </pre> |
| <dl class="fields"> |
| <dt>Overrides: |
| object.__init__ |
| </dt> |
| </dl> |
| </td></tr></table> |
| </div> |
| <a name="chunksize"></a> |
| <div> |
| <table class="details" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr><td> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr valign="top"><td> |
| <h3 class="epydoc"><span class="sig"><span class="sig-name">chunksize</span>(<span class="sig-arg">self</span>)</span> |
| </h3> |
| </td><td align="right" valign="top" |
| ><span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.chunksize">source code</a></span> |
| </td> |
| </tr></table> |
| |
| <pre class="literalblock"> |
| Chunk size for resumable uploads. |
| |
| Returns: |
| Chunk size in bytes. |
| |
| </pre> |
| <dl class="fields"> |
| <dt>Overrides: |
| <a href="apiclient.http.MediaUpload-class.html#chunksize">MediaUpload.chunksize</a> |
| </dt> |
| </dl> |
| </td></tr></table> |
| </div> |
| <a name="mimetype"></a> |
| <div> |
| <table class="details" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr><td> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr valign="top"><td> |
| <h3 class="epydoc"><span class="sig"><span class="sig-name">mimetype</span>(<span class="sig-arg">self</span>)</span> |
| </h3> |
| </td><td align="right" valign="top" |
| ><span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.mimetype">source code</a></span> |
| </td> |
| </tr></table> |
| |
| <pre class="literalblock"> |
| Mime type of the body. |
| |
| Returns: |
| Mime type. |
| |
| </pre> |
| <dl class="fields"> |
| <dt>Overrides: |
| <a href="apiclient.http.MediaUpload-class.html#mimetype">MediaUpload.mimetype</a> |
| </dt> |
| </dl> |
| </td></tr></table> |
| </div> |
| <a name="size"></a> |
| <div> |
| <table class="details" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr><td> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr valign="top"><td> |
| <h3 class="epydoc"><span class="sig"><span class="sig-name">size</span>(<span class="sig-arg">self</span>)</span> |
| </h3> |
| </td><td align="right" valign="top" |
| ><span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.size">source code</a></span> |
| </td> |
| </tr></table> |
| |
| <pre class="literalblock"> |
| Size of upload. |
| |
| Returns: |
| Size of the body, or None of the size is unknown. |
| |
| </pre> |
| <dl class="fields"> |
| <dt>Overrides: |
| <a href="apiclient.http.MediaUpload-class.html#size">MediaUpload.size</a> |
| </dt> |
| </dl> |
| </td></tr></table> |
| </div> |
| <a name="resumable"></a> |
| <div> |
| <table class="details" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr><td> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr valign="top"><td> |
| <h3 class="epydoc"><span class="sig"><span class="sig-name">resumable</span>(<span class="sig-arg">self</span>)</span> |
| </h3> |
| </td><td align="right" valign="top" |
| ><span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.resumable">source code</a></span> |
| </td> |
| </tr></table> |
| |
| <pre class="literalblock"> |
| Whether this upload is resumable. |
| |
| Returns: |
| True if resumable upload or False. |
| |
| </pre> |
| <dl class="fields"> |
| <dt>Overrides: |
| <a href="apiclient.http.MediaUpload-class.html#resumable">MediaUpload.resumable</a> |
| </dt> |
| </dl> |
| </td></tr></table> |
| </div> |
| <a name="getbytes"></a> |
| <div> |
| <table class="details" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr><td> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr valign="top"><td> |
| <h3 class="epydoc"><span class="sig"><span class="sig-name">getbytes</span>(<span class="sig-arg">self</span>, |
| <span class="sig-arg">begin</span>, |
| <span class="sig-arg">length</span>)</span> |
| </h3> |
| </td><td align="right" valign="top" |
| ><span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.getbytes">source code</a></span> |
| </td> |
| </tr></table> |
| |
| <pre class="literalblock"> |
| Get bytes from the media. |
| |
| Args: |
| begin: int, offset from beginning of file. |
| length: int, number of bytes to read, starting at begin. |
| |
| Returns: |
| A string of bytes read. May be shorted than length if EOF was reached |
| first. |
| |
| </pre> |
| <dl class="fields"> |
| <dt>Overrides: |
| <a href="apiclient.http.MediaUpload-class.html#getbytes">MediaUpload.getbytes</a> |
| </dt> |
| </dl> |
| </td></tr></table> |
| </div> |
| <a name="to_json"></a> |
| <div> |
| <table class="details" border="1" cellpadding="3" |
| cellspacing="0" width="100%" bgcolor="white"> |
| <tr><td> |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| <tr valign="top"><td> |
| <h3 class="epydoc"><span class="sig"><span class="sig-name">to_json</span>(<span class="sig-arg">self</span>)</span> |
| </h3> |
| </td><td align="right" valign="top" |
| ><span class="codelink"><a href="apiclient.http-pysrc.html#MediaFileUpload.to_json">source code</a></span> |
| </td> |
| </tr></table> |
| |
| <pre class="literalblock"> |
| Creating a JSON representation of an instance of MediaFileUpload. |
| |
| Returns: |
| string, a JSON representation of this instance, suitable to pass to |
| from_json(). |
| |
| </pre> |
| <dl class="fields"> |
| <dt>Overrides: |
| <a href="apiclient.http.MediaUpload-class.html#to_json">MediaUpload.to_json</a> |
| </dt> |
| </dl> |
| </td></tr></table> |
| </div> |
| <br /> |
| <!-- ==================== NAVIGATION BAR ==================== --> |
| <table class="navbar" border="0" width="100%" cellpadding="0" |
| bgcolor="#a0c0ff" cellspacing="0"> |
| <tr valign="middle"> |
| |
| <!-- Tree link --> |
| <th> <a |
| href="module-tree.html">Trees</a> </th> |
| |
| <!-- Index link --> |
| <th> <a |
| href="identifier-index.html">Indices</a> </th> |
| |
| <!-- Help link --> |
| <th> <a |
| href="help.html">Help</a> </th> |
| |
| <th class="navbar" width="100%"></th> |
| </tr> |
| </table> |
| <table border="0" cellpadding="0" cellspacing="0" width="100%%"> |
| <tr> |
| <td align="left" class="footer"> |
| Generated by Epydoc 3.0.1 on Fri Jun 15 13:13:23 2012 |
| </td> |
| <td align="right" class="footer"> |
| <a target="mainFrame" href="http://epydoc.sourceforge.net" |
| >http://epydoc.sourceforge.net</a> |
| </td> |
| </tr> |
| </table> |
| |
| <script type="text/javascript"> |
| <!-- |
| // Private objects are initially displayed (because if |
| // javascript is turned off then we want them to be |
| // visible); but by default, we want to hide them. So hide |
| // them unless we have a cookie that says to show them. |
| checkCookie(); |
| // --> |
| </script> |
| </body> |
| </html> |