使用boto3发送压缩消息到SQS

问题描述 投票:0回答:1

有没有办法用boto3将压缩消息发送到SQS?我找不到例子。谢谢,斯特拉

我尝试给 send_message 提供字节,但出现错误

client = boto3.client(service, region_name="us-east-1")
msg_body=b'bytes_message'
client.send_message(
    QueueUrl=queue_url,
    MessageBody=msg_body,
    DelaySeconds=delay
    )

your text`Invalid type for parameter MessageBody, value:type: <class 'bytes'>, valid types: <class 'str'>
compression boto3 sendmessage
1个回答
0
投票

使用 (utf-8) 解码字节 在代码的第二行中添加此内容并尝试

msg_body = b'bytes_message'.decode('utf-8') 
© www.soinside.com 2019 - 2024. All rights reserved.