Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用boto写入而不是上载到S3_Python_Amazon S3_Boto_Python 2.6 - Fatal编程技术网

Python 使用boto写入而不是上载到S3

Python 使用boto写入而不是上载到S3,python,amazon-s3,boto,python-2.6,Python,Amazon S3,Boto,Python 2.6,有没有一种方法可以直接写入S3中的文件,而不是上传完整的文件?我知道各种set\u contents\u from\u方法,当我想上传一个完整的文件时,这些方法很有效。我正在寻找一种在数据进入时直接写入S3键的方法 我看到有人提到了Key对象的open\u write方法,但它被明确称为未实现。我不想做下面这种俗气的事: def WriteToS3(file_name,data): current_data = Key.get_contents_as_string(file_name)

有没有一种方法可以直接写入S3中的文件,而不是上传完整的文件?我知道各种
set\u contents\u from\u
方法,当我想上传一个完整的文件时,这些方法很有效。我正在寻找一种在数据进入时直接写入S3键的方法

我看到有人提到了
Key
对象的
open\u write
方法,但它被明确称为未实现。我不想做下面这种俗气的事:

def WriteToS3(file_name,data):
  current_data = Key.get_contents_as_string(file_name)
  new_data = current_data + data
  Key.set_contents_from_string(new_data)

非常感谢您的帮助。

尝试使用S3多部分上传功能来存档此文件。您可以按顺序上载每个部分,并完成上载。请参阅此处的更多详细信息:

由于它基于REST,因此不可能只更新内容的一部分。不幸的是,S3不提供流媒体接口,因此确实没有任何方法可以实现您的建议。