0
votes

The problem I have is the reverse of the one mentioned in this question: Get Public URL for File - Google Cloud Storage - App Engine (Python)

I have the public (serving) URL for an image uploaded to Google Cloud Storage via my Google App Engine Python application. Unfortunately through a yet undetected bug, a record in my database associating the blobstore key (I used blobstore.create_gs_key) and Cloud Storage object and serving URL, was not created.

Now I need to delete that image and all I have is the serving URL, and I need a Cloud Storage object for that.

Any idea if it is possible to get it?

1

1 Answers

0
votes

After inspecting the Blobstore Python API on Github I don't think the API offers an easy programatic method to achieve your specific request.

A possible workaround I could think of is that since you have the Cloud Storage URI and most likely know the bucket name to simply search for orphan blobs on the bucket and delete them. You can find an example on the community here.

Finally, I'd like to advise you to use the App Engine client library for Cloud Storage instead of Blobstore Python API as suggested on this latter documentation.