summaryrefslogtreecommitdiff
path: root/kafka/conn.py
diff options
context:
space:
mode:
authormrtheb <mrlabbe@gmail.com>2014-02-09 13:44:47 -0500
committermrtheb <mrlabbe@gmail.com>2014-02-09 13:44:47 -0500
commita2191e5be5d5fcd212582580c163f4533cca6c73 (patch)
tree6d13a0928f572d99a47299b536cdf209dbd29a5f /kafka/conn.py
parent84de472a4d5b583ff3ed6cc6d92250a7c9291ceb (diff)
downloadkafka-python-a2191e5be5d5fcd212582580c163f4533cca6c73.tar.gz
Support list (or comma-separated) of hosts (replaces host and port arguments)
Diffstat (limited to 'kafka/conn.py')
-rw-r--r--kafka/conn.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/kafka/conn.py b/kafka/conn.py
index de2d385..20f22dc 100644
--- a/kafka/conn.py
+++ b/kafka/conn.py
@@ -17,8 +17,11 @@ def collect_hosts(hosts, randomize=True):
randomize the returned list.
"""
+ if isinstance(hosts, str):
+ hosts = hosts.split(',')
+
result = []
- for host_port in hosts.split(","):
+ for host_port in hosts:
res = host_port.split(':')
host = res[0]