2013-07-31 27 views
1

我想保存從網絡到BLOBSTORE獲取一些數據,但谷歌文檔稱,文件寫入到Google App Engine的Blob存儲的方法將被棄用

推薦使用:使用的文件API功能在這裏將文件寫入Blobstore將在未來的某個時間被刪除,以支持將文件寫入Google Cloud Storage並使用Blobstore爲其提供服務。

在Python代碼如下

from __future__ import with_statement 
from google.appengine.api import files 

# Create the file 
file_name = files.blobstore.create(mime_type='application/octet-stream') 

# Open the file and write to it 
with files.open(file_name, 'a') as f: 
    f.write('data') 

# Finalize the file. Do this before attempting to read it. 
files.finalize(file_name) 

# Get the file's blob key 
blob_key = files.blobstore.get_blob_key(file_name) 

我想知道是否有另一種方式來寫Blob存儲區,而不是正式的上傳方法。

+0

它是會消失因此API棄用Blob存儲區把數據在數據存儲中。您是否閱讀過可能存儲客戶端librbry的入門知識?它的代碼在這個例子中提供了像api這樣的文件。 https://developers.google.com/appengine/docs/python/googlecloudstorageclient/getstarted –

+0

我想將文件存儲在blobstore而不是雲存儲中。 – flyingfoxlee

+0

是的,但blobstore正在消失。您可以繼續使用它和api,直到關閉它。因此,棄用 –

回答

0

的選擇可能是使用TextProperty

相關問題