diff options
author | Dana Powers <dana.powers@gmail.com> | 2016-07-16 13:04:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-16 13:04:28 -0700 |
commit | 20f4c95289c694f81a60228a9820601eb57402f4 (patch) | |
tree | 72be396969e5f04509787f496219c0c8b298336b /kafka/conn.py | |
parent | 061cb4e83469166873912fca2aac62ca8376377f (diff) | |
download | kafka-python-20f4c95289c694f81a60228a9820601eb57402f4.tar.gz |
Add api_version config to KafkaClient, deprecate str in favor of tuples (#761)
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, |