I want to send a messge to RabbitMQ in a dictionary format:
import pika
# ....
my_msg = {}
my_msg["a"] = 1
my_msg["a"]["b"] = 2
channel.basic_publish(exchange="", routing_key="some_key", body=my_msg)
And an error I get:
TypeError: unhashable type: 'slice'
Note that I have plenty of my_msg
and each of them has a few keys, so I need somehow to be able to send a list dictionaries to RabbitMQ.
How can I do that? Or are there other options?
You need to serialize your dictionaries into strings and send them over RabbitMQ.
See this question
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With