1

我正在尝试编写脚本以将一些数据推送到 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)

我的脚本中的片段

谁可以帮我这个事?

4

0 回答 0