From 6fb89c844d207d9ddf3caa195298000b19ac0ac9 Mon Sep 17 00:00:00 2001 From: prithiv Date: Mon, 4 Dec 2017 10:32:35 +0000 Subject: [PATCH] Fix double '/' in the message The usage of ascii encode sometimes appends an extra "/" or an additional space. This patch replaces ascii encoding with string encoding. Signed-off-by: prithiv --- osm_mon/core/message_bus/producer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osm_mon/core/message_bus/producer.py b/osm_mon/core/message_bus/producer.py index a72410a..bccdd4c 100755 --- a/osm_mon/core/message_bus/producer.py +++ b/osm_mon/core/message_bus/producer.py @@ -50,14 +50,14 @@ class KafkaProducer(object): broker = "localhost:9092" ''' - If the broker URI is not set in the env, by default, + If the broker URI is not set in the env by default, localhost container is taken as the host because an instance of is already running. ''' self.producer = kaf( key_serializer=str.encode, - value_serializer=lambda v: json.dumps(v).encode('ascii'), + value_serializer=lambda v: json.dumps(v).str.encode, bootstrap_servers=broker, api_version=(0, 10)) def publish(self, key, value, topic=None): -- 2.25.1