【发布时间】:2021-08-19 20:36:16
【问题描述】:
我正在用 python 编写一个脚本来接收 Amazon SQS 消息。
在 Amazon SQS 队列中我有这样的消息
'{"Test":"Machine-name", "State":"Request", "Description":""}'
在python脚本中我可以收到这条消息;但是,它抱怨如下:
msg = json.loads(message)
File "/usr/lib/python3.8/json/__init__.py", line 341, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not sqs.Message
我相信我插入队列的消息是 json 格式,但为什么它识别为 sqs.Message ?
如何转换成json格式?
谢谢,
【问题讨论】:
-
"message.body" 是解决方案!
标签: json amazon-web-services amazon-sqs