summaryrefslogtreecommitdiff
path: root/kafka/client.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@rd.io>2015-03-02 09:34:06 -0800
committerDana Powers <dana.powers@rd.io>2015-03-02 09:34:06 -0800
commit082cda6a7235df15d38102556f7bfe09e43b39fa (patch)
treeff36ac18f811676fb6701369259306ed65edf2e9 /kafka/client.py
parent0f04eba0977c77fd9edd0dc336d4934cd9de1348 (diff)
downloadkafka-python-082cda6a7235df15d38102556f7bfe09e43b39fa.tar.gz
Avoid topic_partitions KeyError in KafkaClient
Diffstat (limited to 'kafka/client.py')
-rw-r--r--kafka/client.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/kafka/client.py b/kafka/client.py
index 3c2a727..53b6ad0 100644
--- a/kafka/client.py
+++ b/kafka/client.py
@@ -86,7 +86,7 @@ class KafkaClient(object):
self.load_metadata_for_topics(topic)
# If the partition doesn't actually exist, raise
- if partition not in self.topic_partitions[topic]:
+ if partition not in self.topic_partitions.get(topic, []):
raise UnknownTopicOrPartitionError(key)
# If there's no leader for the partition, raise