diff options
author | Dana Powers <dana.powers@gmail.com> | 2016-07-16 10:29:37 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2016-07-16 12:07:26 -0700 |
commit | 2c4b9cdf2cc18ccd40d2489e74766c6b702c2725 (patch) | |
tree | 72be396969e5f04509787f496219c0c8b298336b /kafka/conn.py | |
parent | 061cb4e83469166873912fca2aac62ca8376377f (diff) | |
download | kafka-python-client_api_version.tar.gz |
Add api_version config to KafkaClient, deprecate str in favor of tuplesclient_api_version
Diffstat (limited to 'kafka/conn.py')
-rw-r--r-- | kafka/conn.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kafka/conn.py b/kafka/conn.py index 0418bc5..6028867 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -541,7 +541,12 @@ class BrokerConnection(object): return self._correlation_id def check_version(self, timeout=2, strict=False): - """Attempt to guess the broker version. This is a blocking call.""" + """Attempt to guess the broker version. + + Note: This is a blocking call. + + Returns: version tuple, i.e. (0, 10), (0, 9), (0, 8, 2), ... + """ # Monkeypatch the connection request timeout # Generally this timeout should not get triggered @@ -643,7 +648,7 @@ class BrokerConnection(object): log.removeFilter(log_filter) self.config['request_timeout_ms'] = stashed_request_timeout_ms - return version + return tuple(map(int, version.split('.'))) def __repr__(self): return "<BrokerConnection host=%s/%s port=%d>" % (self.hostname, self.host, |