From 552c067e793f4747a1e193acde2638c3c991cf0c Mon Sep 17 00:00:00 2001 From: Martin Englund Date: Sun, 22 Jan 2017 18:30:33 -0800 Subject: [PATCH 1/6] add ping method to the client --- influxdb/client.py | 12 ++++++++++++ influxdb/tests/client_test.py | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/influxdb/client.py b/influxdb/client.py index ab9aa409..600173f4 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -410,6 +410,18 @@ def write_points(self, retention_policy=retention_policy, tags=tags, protocol=protocol) + def ping(self): + """Check connectivity to influxdb + :returns: The version of the influxdb the client is connected to + """ + response = self.request( + url="ping", + method='GET', + expected_response_code=204 + ) + + return response.headers['X-Influxdb-Version'] + def _batches(self, iterable, size): for i in xrange(0, len(iterable), size): yield iterable[i:i + size] diff --git a/influxdb/tests/client_test.py b/influxdb/tests/client_test.py index f586df3f..24fd0b05 100644 --- a/influxdb/tests/client_test.py +++ b/influxdb/tests/client_test.py @@ -403,6 +403,17 @@ def test_query_fail(self): with _mocked_session(self.cli, 'get', 401): self.cli.query('select column_one from foo;') + def test_ping(self): + with requests_mock.Mocker() as m: + m.register_uri( + requests_mock.GET, + "http://localhost:8086/ping", + status_code=204, + headers={'X-Influxdb-Version': '1.2.3'} + ) + version = self.cli.ping() + self.assertEqual(version, '1.2.3') + def test_create_database(self): with requests_mock.Mocker() as m: m.register_uri( From b9aeef9e44911eca4884e8131044ab224fef48d2 Mon Sep 17 00:00:00 2001 From: Martin Englund Date: Sat, 11 Feb 2017 07:51:41 -0800 Subject: [PATCH 2/6] capitalize and pep257 compliance --- influxdb/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/influxdb/client.py b/influxdb/client.py index 600173f4..fe218aac 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -411,9 +411,10 @@ def write_points(self, tags=tags, protocol=protocol) def ping(self): - """Check connectivity to influxdb - :returns: The version of the influxdb the client is connected to + """Check connectivity to InfluxDB + :returns: The version of the InfluxDB the client is connected to """ + response = self.request( url="ping", method='GET', From 738b033a242d38e826f7f78b1876ac2368035590 Mon Sep 17 00:00:00 2001 From: Martin Englund Date: Sat, 11 Feb 2017 13:22:13 -0800 Subject: [PATCH 3/6] one more try for pep257 compliance for the ping function --- influxdb/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/influxdb/client.py b/influxdb/client.py index fe218aac..71e207ac 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -411,10 +411,10 @@ def write_points(self, tags=tags, protocol=protocol) def ping(self): - """Check connectivity to InfluxDB + """Check connectivity to InfluxDB. + :returns: The version of the InfluxDB the client is connected to """ - response = self.request( url="ping", method='GET', From 70d0633b69804fe79e765d16f79e5966dc09bd44 Mon Sep 17 00:00:00 2001 From: xginn8 Date: Wed, 15 Nov 2017 19:14:05 -0500 Subject: [PATCH 4/6] Update client.py --- influxdb/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/influxdb/client.py b/influxdb/client.py index 04f4c400..68261ece 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -450,7 +450,7 @@ def write_points(self, retention_policy=retention_policy, tags=tags, protocol=protocol) return True - + return self._write_points(points=points, time_precision=time_precision, database=database, From a63c2bcd2b7187605eccd521ef26801ffcb2836c Mon Sep 17 00:00:00 2001 From: xginn8 Date: Wed, 15 Nov 2017 19:20:43 -0500 Subject: [PATCH 5/6] Update client_test.py fixing up failing CI tests --- influxdb/tests/client_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/influxdb/tests/client_test.py b/influxdb/tests/client_test.py index c7d1e0e5..ff325907 100644 --- a/influxdb/tests/client_test.py +++ b/influxdb/tests/client_test.py @@ -419,6 +419,7 @@ def test_query_fail(self): self.cli.query('select column_one from foo;') def test_ping(self): + """Test ping querying InfluxDB version.""" with requests_mock.Mocker() as m: m.register_uri( requests_mock.GET, From 53376d4c5b43f7a711d6cd02f0512a425bd25b05 Mon Sep 17 00:00:00 2001 From: xginn8 Date: Wed, 15 Nov 2017 19:20:50 -0500 Subject: [PATCH 6/6] Update client_test.py fixing up failing CI tests pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy