8000 JSON dump modified to allows python `NaN` values to be written as `nu… · svernede/influxdb-python@78b7134 · GitHub
[go: up one dir, main page]

Skip to content

Commit 78b7134

Browse files
committed
JSON dump modified to allows python NaN values to be written as null in the JSON data
see influxdata#195 Adds a new dependency to module `simplejson` but the same effect is difficult to achieve with base module `json` see http://stackoverflow.com/questions/28639953/python-nan-json-encoder
1 parent 3e1a03c commit 78b7134

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

influxdb/influxdb08/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import requests
88
import requests.exceptions
99
import warnings
10+
import simplejson
1011
from sys import version_info
1112

1213
from influxdb import chunked_json
@@ -226,7 +227,7 @@ def request(self, url, method='GET', params=None, data=None,
226227
params.update(auth)
227228

228229
if data is not None and not isinstance(data, str):
229-
data = json.dumps(data)
230+
data = simplejson.dumps(data, ignore_nan=True)
230231

231232
# Try to send the request a maximum of three times. (see #103)
232233
# TODO (aviau): Make this configurable.

0 commit comments

Comments
 (0)
0