diff options
author | mrtheb <mrlabbe@gmail.com> | 2014-02-09 13:44:47 -0500 |
---|---|---|
committer | mrtheb <mrlabbe@gmail.com> | 2014-02-09 13:44:47 -0500 |
commit | a2191e5be5d5fcd212582580c163f4533cca6c73 (patch) | |
tree | 6d13a0928f572d99a47299b536cdf209dbd29a5f /kafka/conn.py | |
parent | 84de472a4d5b583ff3ed6cc6d92250a7c9291ceb (diff) | |
download | kafka-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.py | 5 |
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] |