From d196ae641e49ddcad335cac7c7223254c670f57c Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Wed, 29 Oct 2014 14:53:21 +0100 Subject: [PATCH 1/2] Fix json decoding on Python 3 --- influxdb/client.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/influxdb/client.py b/influxdb/client.py index 00365517..4d22329c 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -322,13 +322,7 @@ def query(self, query, time_precision='s', chunked=False): status_code=200 ) - try: - res = json.loads(response.content) - except TypeError: - # must decode in python 3 - res = json.loads(response.content.decode('utf8')) - - return res + return response.json() # Creating and Dropping Databases # @@ -396,7 +390,7 @@ def get_database_list(self): status_code=200 ) - return json.loads(response.content) + return response.json() def delete_series(self, series): """ From f174e27f32df3722004c38428ad993e998a249e0 Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Thu, 30 Oct 2014 15:05:03 +0100 Subject: [PATCH 2/2] Fix mock session for tests HTTP body content is expected to be bytes, not unicode. --- tests/influxdb/client_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/influxdb/client_test.py b/tests/influxdb/client_test.py index 5995dcb8..00cf2cac 100644 --- a/tests/influxdb/client_test.py +++ b/tests/influxdb/client_test.py @@ -16,7 +16,7 @@ def _build_response_object(status_code=200, content=""): resp = requests.Response() resp.status_code = status_code - resp._content = content + resp._content = content.encode("utf8") return resp 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