Skip to content

Commit 991ef5b

Browse files
committed
Merge pull request influxdata#71 from jonashaag/patch-1
Fix json decoding on Python 3 (thanks @jonashaag)
2 parents 376fb43 + f174e27 commit 991ef5b

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

influxdb/client.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,7 @@ def query(self, query, time_precision='s', chunked=False):
322322
status_code=200
323323
)
324324

325-
try:
326-
res = json.loads(response.content)
327-
except TypeError:
328-
# must decode in python 3
329-
res = json.loads(response.content.decode('utf8'))
330-
331-
return res
325+
return response.json()
332326

333327
# Creating and Dropping Databases
334328
#
@@ -396,7 +390,7 @@ def get_database_list(self):
396390
status_code=200
397391
)
398392

399-
return json.loads(response.content)
393+
return response.json()
400394

401395
def delete_series(self, series):
402396
"""

tests/influxdb/client_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
def _build_response_object(status_code=200, content=""):
1717
resp = requests.Response()
1818
resp.status_code = status_code
19-
resp._content = content
19+
resp._content = content.encode("utf8")
2020
return resp
2121

2222

0 commit comments

Comments
 (0)
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