|
5 | 5 | import json
|
6 | 6 | import socket
|
7 | 7 | import requests
|
| 8 | +import warnings |
8 | 9 |
|
9 | 10 | from influxdb import chunked_json
|
10 | 11 |
|
@@ -166,7 +167,7 @@ def request(self, url, method='GET', params=None, data=None,
|
166 | 167 | # by doing a POST to /db/foo_production/series?u=some_user&p=some_password
|
167 | 168 | # with a JSON body of points.
|
168 | 169 |
|
169 |
| - def write_points(self, data, *args, **kwargs): |
| 170 | + def write_points(self, data, time_precision='s', *args, **kwargs): |
170 | 171 | """
|
171 | 172 | write_points()
|
172 | 173 |
|
@@ -198,19 +199,27 @@ def list_chunks(l, n):
|
198 | 199 | "name": name,
|
199 | 200 | "columns": columns
|
200 | 201 | }]
|
201 |
| - time_precision = kwargs.get('time_precision', 's') |
202 |
| - self.write_points_with_precision( |
| 202 | + self._write_points( |
203 | 203 | data=item,
|
204 | 204 | time_precision=time_precision)
|
205 | 205 |
|
206 | 206 | return True
|
207 | 207 |
|
208 |
| - return self.write_points_with_precision(data, *args, **kwargs) |
| 208 | + return self._write_points(data=data, time_precision=time_precision) |
209 | 209 |
|
210 | 210 | def write_points_with_precision(self, data, time_precision='s'):
|
211 | 211 | """
|
212 |
| - Write to multiple time series names |
| 212 | + DEPRECATED. Write to multiple time series names |
| 213 | +
|
213 | 214 | """
|
| 215 | + warnings.warn( |
| 216 | + "write_points_with_precision is deprecated, and will be removed " |
| 217 | + "in future versions. Please use " |
| 218 | + "``InfluxDBClient.write_points(time_precision='..')`` instead.", |
| 219 | + FutureWarning) |
| 220 | + return self._write_points(data=data, time_precision=time_precision) |
| 221 | + |
| 222 | + def _write_points(self, data, time_precision): |
214 | 223 | if time_precision not in ['s', 'm', 'ms', 'u']:
|
215 | 224 | raise Exception(
|
216 | 225 | "Invalid time precision is given. (use 's', 'm', 'ms' or 'u')")
|
|
0 commit comments