python - TypeError:预期的字符串或类似字节的对象 - Python (boto3)
问题描述
我正在尝试使用 boto3 和该put_bucket_encryption()
函数在 S3 存储桶上启用加密。但是,我似乎收到以下错误:
[ERROR] TypeError: expected string or bytes-like object
特别是,它抱怨这条线:
'SSEAlgorithm': 'AES256'
下面是我的代码:
s3_client = boto3.client('s3', region_name='us-east-1')
s3_client.put_bucket_encryption(
Bucket=bucket,
ServerSideEncryptionConfiguration={
'Rules':[
{
'ApplyServerSideEncryptionByDefault': {
'SSEAlgorithm': 'AES256'
}
}
]
}
)
我尝试将整个对象转换为字符串以及它抱怨的行,但是无济于事。任何帮助表示赞赏。
解决方案
推荐阅读
- angularjs - 我正在尝试在函数中添加 2 个属性的值,但 1 个属性的值未定义。我只需要增加 css bar 的百分比
- php - PHP - 在多维数组中搜索匹配项并返回数组键
- reactjs - 浏览器显示重定向的 url 但组件未呈现 - Redux Saga
- c# - 无论使用鼠标还是触摸,如何支持 MouseUp、MouseDown 和 MouseMove 事件
- html - 如何在 Angular 输入的 [value] 属性中使用多个变量
- java - 测试 Kafka、Spark 和 ES 集成的正确方法
- python - Wheel 包的 RECORD 文件中的 hash 是如何构造的?
- email - 如何代表外部托管域接收电子邮件
- ios - Swift - 为一个 ViewController 内的两个输入字段设置不同的最大长度
- r - 在执行长计算时更新 actionButton