Deprecation Notice: The Files API and the functions described on this page are going to be removed at some time in the future. The documentation for the deprecated API is retained for the convenience of developers still using the feature.
The google.appengine.api.files.blobstore
package provides the following functions:
- create(mime_type=application/octet-stream, _blobinfo_uploaded_filename=None)
-
Create a writable blobstore blob. You can use this method to create an empty file, and you can use the other functions in this package to get information about the file.
To work with this file, use the Files API in
google.appengine.api.files.file
. To write to this file, open it with theopen()
function from the Files API and then use the other Files API functions to manipulate it.To read the file or obtain its blob key, finalize it using the Files API
finalize()
method and then callget_blob_key()
.Arguments
- mime_type
- A string providing the MIME type for content in the newly created blob.
Returns a filename for the blobstore file.
- get_blob_key(create_file_name)
-
Gets the blob key for a finalized blobstore file. To finalize the file, use the
finalize()
function in the Files API. This API is currently undocumented, but you can find the functions in thegoogle.appengine.api.files.file
package.Arguments
- create_file_name
- The filename of the writable blobstore file returned by the
create()
function.
Returns a
BlobKey
instance for the corresponding blob orNone
if the blob referred to by the file name is not finalized. Raises anInvalidFileNameError
if the filename is not valid or is not finalized. - get_file_name(blob_key)
-
Gets a filename based on the file's blob key.
Arguments
- blob_key
- The blob key for the writable blobstore file returned by the
get_blob_key()
function.
Returns the filename as string. You can pass this string to the Files API in order to read the file. This API is currently undocumented, but you can find the functions in the
google.appengine.api.files.file
package.