diff --git a/influxdb_api.py b/influxdb_api.py index b72dcfa..c8ea92f 100644 --- a/influxdb_api.py +++ b/influxdb_api.py @@ -391,18 +391,18 @@ def query_curve_by_ID_property_daterange(ID: str, type: str, property: str, star # 示例调用 if __name__ == "__main__": url = "http://localhost:8086" # 替换为你的InfluxDB实例地址 - token = "Z4UZj9HuLwLlwoApywvT2nGVP3bwLy18y-sJQ7enzZlJd8YMzMWbBA6F-q4gBiZ-7-IqdxR5aR9LvicKiSNmnA==" # 替换为你的InfluxDB Token - org_name = "beibei" # 替换为你的Organization名称 + token = "xGDM5RZqRJAuzAGS-otXUdC2NFdY75qJAjRLqAB4p5WcIIAlIUpOpT8_yA16AOHmJWerwQ_08gwb84sy42jnZQ==" # 替换为你的InfluxDB Token + org_name = "TJWATEORG" # 替换为你的Organization名称 + client = InfluxDBClient(url=url, token=token, org=org_name) - # client = InfluxDBClient(url=url, token=token) + # 检查连接状态 + try: + create_and_initialize_buckets(client, org_name) + except Exception as e: + print(f"连接失败: {e}") + finally: + client.close() - # # 检查连接状态 - # try: - # create_and_initialize_buckets(client, org_name) - # except Exception as e: - # print(f"连接失败: {e}") - # finally: - # client.close() with InfluxDBClient(url=url, token=token, org=org_name) as client: bucket_name = "realtime_data" # 数据存储的 bucket 名称