from influxdb_client import InfluxDBClient, Point from influxdb_client.client.write_api import SYNCHRONOUS class Database(): def __init__(self): self.client = InfluxDBClient(url="http://localhost:8086", token="DTvugv1tGXDYplEjgBduFTBItsa3WAyfZ5Dw5P3xZPDr37ZqNDmwOm-wtCK0z2jr6bUyb0Qj94nDB4jmR52siA==", org="laempe") self.bucket = "energy-monitor" self.write_api = self.client.write_api(write_options=SYNCHRONOUS) self.query_api = self.client.query_api() def write(self, point): self.write_api.write(bucket=self.bucket, record=point)