Search code examples
pythongoogle-app-engineblobstore

How to set a custom Key for files uploaded to appengine using blobstore


Following the appengine Uploading a blob instructions, I have been available to upload/download images.

But I want to found a method for preventing duplicates, therefore I would like to know if it is possible to have a custom key for the blobstore objects, or use the MD5 as the Key, so that at least I could overwrite existing files.

Is there any hook or some extra parameter that I could use within the blobstore.create_upload_url that could help to specify a custom Key for the uploaded object?


Solution

  • Google is moving away from the blobstore. You can also use the Cloudstorage Client Library.

    Some of the benefits:

    • since 1,9.0 free quota in the default GCS bucket
    • use folders and filenames and you can overwrite (replace) existing files.
    • create a serving_url for images and other files, which will be served by Google
    • and more ..

    I have created this gist to show how to use GCS in Google App Engine.