Avoid topic_partitions KeyError in KafkaClient

This commit is contained in:
Dana Powers
2015-03-02 09:34:06 -08:00
parent 0f04eba097
commit 082cda6a72

View File

@@ -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