influxdb.exceptions.InfluxDBClientError_“ error”:“无法解析为无效的布尔值

时间:2019-08-03 23:05:58

标签: parsing influxdb-python

我正在尝试编写脚本以将一些数据推送到InfluxDB,并且代码执行时没有错误/警告。 我有以下来自python的输出,我想将其插入Influxdb中:

[{'measurement': '2GHz', 'tags': {'ap_name': 'l1:10c:17:gf:3j:d1', 'band': 
'2GHz', 'channel': 1, 'eirp': 11}, 'fields': {'CBW20': [1, 6, 11]}}]

我看到以下错误:

line 50, in abc client.write_points(json)
  File "C:\Users\angadiai\PycharmProjects\Practise\venv\lib\site-packages\influxdb\client.py", line 490, in write_points
    tags=tags, protocol=protocol)
  File "C:\Users\angadiai\PycharmProjects\Practise\venv\lib\site-packages\influxdb\client.py", line 551, in _write_points
    protocol=protocol
  File "C:\Users\angadiai\PycharmProjects\Practise\venv\lib\site-packages\influxdb\client.py", line 327, in write
    headers=headers
  File "C:\Users\angadiai\PycharmProjects\Practise\venv\lib\site-packages\influxdb\client.py", line 286, in request
    raise InfluxDBClientError(response.content, response.status_code)
influxdb.exceptions.InfluxDBClientError: 400: {"error":"unable to parse '2GHz,ap_name=f0:5c:19:cb:3d:d0,band=2GHz,channel=1,eirp=11 CBW20=[1, 6, 11]': invalid boolean"}
json = [
            {
                "measurement": "2GHz",
                "tags": {
                    "ap_name": specific_result["ap_name"],
                    "band": specific_result["band"],
                    "channel": specific_result["channel"],
                    "eirp": specific_result["eirp"]
                },
                "fields": {
                    "CBW20": specific_result["CBW20"]
                }
            }
        ]
        print(json)

        client = InfluxDBClient('localhost', 8086, database='seconddb')
        client.switch_database('seconddb')
        client.write_points(json)
        result = client.query('select 
"band","channel","ap_name","eirp","CBW20" from 
"seconddb"."autogen"."solver";')
        print(result.raw)

我脚本中的片段

有人可以帮我吗?

0 个答案:

没有答案