【发布时间】:2018-01-02 15:43:26
【问题描述】:
我正在尝试通过我的服务器将二进制文件从客户端请求流式传输到 Google Cloud Storage。
我正在使用 Tornado 框架将数据从请求流式传输到服务器,并使用 Google Cloud Storage API 将文件流式传输到 Google -upload_from_file 方法。
我是 Tornado 的新手,我正在使用 @stream_request_body 装饰器,因此我可以分块从请求中获取数据并将每个块上传到 Google。
我尝试打开一个类似文件的对象,在将“文件”本身上传到 Google 时,我可以将每个块写入该对象。
问题是在我开始向其写入块之前,我无法将“文件”上传到 Google。
任何帮助将不胜感激。
【问题讨论】:
-
"The problem is that I can't upload the 'file' to Google before I start writing chunks to it."那么,在你写完第一个块之后开始上传?或者你的意思是在所有的块都写完之前你不能上传文件?
标签: python file-upload stream google-cloud-storage tornado