
[英]How to use Python smart_open module to write to S3 with server-side encryption
[英]How to use smart_open to write a stream to a KMS-encrypted S3 bucket?
我正在尝试使用 smart_open 将流写入 KMS 加密的 S3 存储桶,但无济于事。 查看smart_open的代码,似乎有一个测试用例,但我无法运行它:
@_test_case
def test_s3_encrypted_file(benchmark, uri):
text = 'с гранатою в кармане, с чекою в руке'
s3_upload = {'ServerSideEncryption': 'AES256'}
actual = benchmark(write_read, uri, text, 'w', 'r', 'utf-8', s3_upload=s3_upload)
assert actual == text
我认为这会起作用,但它只是说 s3_upload 不是一个选项:
file = smart_open.open(url, 'w', transport_params={'session': session, s3_upload={'ServerSideEncryption': 'aws:kms', 'SSEKMSKeyId': key}})
file.write(content)
file.close()
知道我做错了什么吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.