| Trees | Indices | Help |
|---|
|
|
A MediaUpload for a io.Base objects.
Note that the Python file object is compatible with io.Base and can be used
with this class also.
fh = io.BytesIO('...Some data to upload...')
media = MediaIoBaseUpload(fh, mimetype='image/png',
chunksize=1024*1024, resumable=True)
farm.animals().insert(
id='cow',
name='cow.png',
media_body=media).execute()
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
Constructor.
Args:
fh: io.Base or file object, The source of the bytes to upload. MUST be
opened in blocking mode, do not use streams opened in non-blocking mode.
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.
|
Chunk size for resumable uploads. Returns: Chunk size in bytes.
|
Mime type of the body. Returns: Mime type.
|
Size of upload. Returns: Size of the body, or None of the size is unknown.
|
Whether this upload is resumable. Returns: True if resumable upload or False.
|
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.
|
This upload type is not serializable.
|
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Fri Jun 15 13:13:23 2012 | http://epydoc.sourceforge.net |