diff options
author | John Anderson <sontek@gmail.com> | 2015-01-24 16:32:09 -0800 |
---|---|---|
committer | John Anderson <sontek@gmail.com> | 2015-01-24 16:32:09 -0800 |
commit | 72bec18adde851510c1c627ce8dee659425f727b (patch) | |
tree | 5ae44a22d7678a0843e914bf78b84100148cd5c7 /kafka | |
parent | 3a52d18faf0d46d3611e9fc274a03877c88f118e (diff) | |
download | kafka-python-72bec18adde851510c1c627ce8dee659425f727b.tar.gz |
Just encode to bytes if it isn't bytes.
Diffstat (limited to 'kafka')
-rw-r--r-- | kafka/producer/simple.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kafka/producer/simple.py b/kafka/producer/simple.py index 17e0977..2699cf2 100644 --- a/kafka/producer/simple.py +++ b/kafka/producer/simple.py @@ -70,10 +70,12 @@ class SimpleProducer(Producer): def send_messages(self, topic, *msg): if not isinstance(topic, six.binary_type): - raise TypeError("topic must be type bytes") + topic = topic.encode('utf-8') partition = self._next_partition(topic) - return super(SimpleProducer, self).send_messages(topic, partition, *msg) + return super(SimpleProducer, self).send_messages( + topic, partition, *msg + ) def __repr__(self): return '<SimpleProducer batch=%s>' % self.async |