diff --git a/influxdb/client.py b/influxdb/client.py index f8cea2ac..7930679c 100644 --- a/influxdb/client.py +++ b/influxdb/client.py @@ -271,6 +271,7 @@ def write(self, data, params=None, expected_response_code=204, :param data: the data to be written :type data: (if protocol is 'json') dict (if protocol is 'line') sequence of line protocol strings + or single string :param params: additional parameters for the request, defaults to None :type params: dict :param expected_response_code: the expected response code of the write @@ -292,6 +293,8 @@ def write(self, data, params=None, expected_response_code=204, if protocol == 'json': data = make_lines(data, precision).encode('utf-8') elif protocol == 'line': + if isinstance(data, str): + data = [data] data = ('\n'.join(data) + '\n').encode('utf-8') self.request(
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: