本文介绍了将App Engine Blobkey解码为Google云端存储文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据库充满BlobKeys,以前通过标准的Google App Engine上传过程,并通过设置 gs_bucket_name 参数将每个上传文件传送到同一Google云端存储分区。



我想要做的是能够解码现有的blobkeys,以便我可以获取他们的Google Cloud Storage文件名。我知道我 可以 使用属性来自并没有做到这一点,因为它取代了谷歌存储文件名并创建了一个blobkey。



那么,我怎样才能把一个以前上传的blobkey Google云存储存储分区通过应用引擎,并获得它的Google云存储文件名?(python)

解决方案

您可以获取cloudstorage文件名只存在于上传处理程序(fileInfo.gs_object_name)中,并将其存储在数据库中。之后,它将丢失,并且似乎不会保留在BlobIn中fo或其他元数据结构。



更新:我能够解码Blobstore-Viewer中的SDK-BlobKey:encoded_gs_file:base64-encoded-filename-here。然而,真实的东西不是base64编码的。



create_gs_key(文件名,rpc =无)... Google说:以字符串形式返回加密的blob密钥。有没有人猜测为什么这是加密的?

I've got a database full of BlobKeys that were previously uploaded through the standard Google App Engine create_upload_url() process, and each of the uploads went to the same Google Cloud Storage bucket by setting the gs_bucket_name argument.

What I'd like to do is be able to decode the existing blobkeys so I can get their Google Cloud Storage filenames. I understand that I could have been using the gs_object_name property from the FileInfo class, except:

Meaning gs_object_name property is only available in the upload handler, and if I haven't been saving it at that time then its lost.

Also, create_gs_key() doesn't do the trick because it instead takes a google storage filename and creates a blobkey.

So, how can I take a blobkey that was previously uploaded to a Google Cloud Storage bucket through app engine, and get it's Google Cloud Storage filename? (python)

解决方案

You can get the cloudstorage filename only in the upload handler (fileInfo.gs_object_name) and store it in your database. After that it is lost and it seems not to be preserved in BlobInfo or other metadata structures.

https://developers.google.com/appengine/docs/python/blobstore/fileinfoclass

Update: I was able to decode a SDK-BlobKey in Blobstore-Viewer: "encoded_gs_file:base64-encoded-filename-here". However the real thing is not base64 encoded.

create_gs_key(filename, rpc=None) ... Google says: "Returns an encrypted blob key as a string." Does anyone have a guess why this is encrypted?

这篇关于将App Engine Blobkey解码为Google云端存储文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-21 01:40