查看源代码:
def create_gs_key(filename, rpc=None):
"""Create an encoded key for a Google Storage file.
The created blob key will include short lived access token using the
application's service account for authorization.
This blob key should not be stored permanently as the access token will
expire.
Args:
filename: The filename of the google storage object to create the key for.
rpc: Optional UserRPC object.
Returns:
An encrypted blob key object that also contains a short term access token
that represents the application's service account.
"""
rpc = create_gs_key_async(filename, rpc)
return rpc.get_result()
这与文档所说的相矛盾:
您可以安全地保存此函数生成的 blob 密钥,就像您可以在 Blobstore API 中保存普通的 blob 密钥一样。
我的建议是,由于您正在使用该create_gs_key
功能,因此您已经知道所需的文件名。因此,BlobKey
每次您想与相关文件交互时,存储此值以生成与 BlobStore API 一起使用的值(例如get
或delete
)
更新:提交了
一个错误报告来修复文档。