AppEngine:离开 Blobstore 并进入 S3?
我正在将数据上传到 blobstore。它应该只暂时停留在那里,并从我的 AppEngine 应用程序内上传到 Amazon S3。
看来我只能通过 BlobDonwloadHandler 获取数据,如 Blobstore API 中所述:http://code.google.com/intl/de-DE/appengine/docs/python/blobstore/overview.html#Serving_a_Blob
所以我尝试获取该 blob我的应用程序中的特定下载 URL(记住我昨天的问题)。从 AppEngine(而不是开发服务器)内部获取内部 URL 是有效的,即使它的风格很糟糕 - 我知道。
但获取斑点是行不通的。我的代码看起来像:
result = urllib2.urlopen('http://my-app-url.appspot.com/get_blob/'+str(qr.blob_key))
我得到了
下载错误:应用程序错误:2
提出者:
文件 “/base/python_runtime/python_lib/versions/1/google/appengine/api/urlfetch.py”, 第 332 行,在 _get_fetch_result 中 引发下载错误(str(err))
即使在搜索之后我真的不知道该怎么做。
我见过的所有教程都只关注通过 URL 向用户提供服务。但我想从 Blobstore 检索 blob 并将其发送到 S3 存储桶。有人知道我如何实现这一点,或者甚至不可能吗?
提前致谢。
I'm uploading data to the blobstore. There should it stay only temporary and be uploaded from within my AppEngine app to Amazon S3.
As it seems I can only get the data through a BlobDonwloadHandler as described at the Blobstore API: http://code.google.com/intl/de-DE/appengine/docs/python/blobstore/overview.html#Serving_a_Blob
So I tried to fetch that blob specific download URL from within my application (remember my question yesterday). Fetching internal URLs from within the AppEngine (not the development server) is working, even it´s bad style - I know.
But getting the blob is not working. My code looks like:
result = urllib2.urlopen('http://my-app-url.appspot.com/get_blob/'+str(qr.blob_key))
And I'm getting
DownloadError: ApplicationError: 2
Raised by:
File
"/base/python_runtime/python_lib/versions/1/google/appengine/api/urlfetch.py",
line 332, in _get_fetch_result
raise DownloadError(str(err))
Even after searching I really don't know what to do.
All tutorials I've seen are focusing only on serving through a URL back to the user. But I want to retrieve the blob from the Blobstore and send it to a S3 bucket. Anyone any idea how I could realize that or is that even not possible?
Thanks in advance.
您可以使用 BlobReader 访问该 Blob 并将其发送到 S3。
http://code.google.com/intl /de-DE/appengine/docs/python/blobstore/blobreaderclass.html
You can use a BlobReader to access that Blob and send that to S3.
http://code.google.com/intl/de-DE/appengine/docs/python/blobstore/blobreaderclass.html