Skip to content

Commit 3a08029

Browse files
committed
Added missing database in params.
Receive an unique point and add it to a list in data["points"] (although it's an unnecesary overhead)
1 parent dcb446f commit 3a08029

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

influxdb/client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def request(self, url, method='GET', params=None, data=None,
242242
else:
243243
raise InfluxDBClientError(response.content, response.status_code)
244244

245-
def write(self, data, params=None, expected_response_code=204):
245+
def write(self, point, params={}, expected_response_code=204):
246246
"""Write data to InfluxDB.
247247
248248
:param data: the data to be written
@@ -256,6 +256,11 @@ def write(self, data, params=None, expected_response_code=204):
256256
:rtype: bool
257257
"""
258258

259+
data = {"points": [point] }
260+
261+
if not 'db' in params:
262+
params['db'] = self._database
263+
259264
headers = self._headers
260265
headers['Content-type'] = 'application/octet-stream'
261266

0 commit comments

Comments
 (0)