![](/img/trans.png)
[英]How to stream very large file to s3 from url using boto3 and Python?
[英]How to stream from/to stdin/stdout to/from S3 using boto3
我正在尋找幫助,找出如何使用boto3從stdin和stdout流式傳輸對象。 AWS S3 cp命令可以通過指定' - '作為文件名來實現,但查看boto3文檔我不明白如何。
對於STDOUT
的對象,可以將S3對象作為流打開
s3 = boto3.client('s3')
s3.download_fileobj('your_bucket', 'your_key', sys.stdout)
從STDIN
上傳它幾乎是一樣的,但根據你想做什么,你可以讓你的生活更輕松(nb python 3
here`)
some_stuff = input('type something: ')
s3.put_object(**{
'Bucket': 'your_bucket',
'Key': 'your_key',
'Body': some_stuff
})
這可能呢?
import sys
sys.stdin, sys.stdout
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.