Python 将GAE BlobInfo转换为文件对象

Python 将GAE BlobInfo转换为文件对象,python,google-app-engine,google-cloud-storage,Python,Google App Engine,Google Cloud Storage,如何将Google App Engine BlobInfo对象转换为类似文件的对象以传递到Google云存储?我认为没有直接转换的机制 您需要使用BlobReader打开blob并将其写入cloudstorage 大概是这样的: blob_reader = BlobReader(blob_info.key()) data = blob_reader.read() filename = '/yourbucket/your_file_filename' with cloudstorage.open(

如何将Google App Engine BlobInfo对象转换为类似文件的对象以传递到Google云存储?

我认为没有直接转换的机制

您需要使用BlobReader打开blob并将其写入cloudstorage

大概是这样的:

blob_reader = BlobReader(blob_info.key())
data = blob_reader.read()
filename = '/yourbucket/your_file_filename'
with cloudstorage.open(filename, 'w') as f: 
    f.write(data)
云存储是

如果需要迁移大量数据,可能会有所帮助