In Line 6 query = 'from(bucket: "my-bucket")\ how do we pass bucket as variable instead of hard-coding it ?
Code Source -> https://www.influxdata.com/blog/getting-started-with-python-and-influxdb-v2-0/ Script for writing and querying points to InfluxDB with the Python Client
from influxdb_client import InfluxDBClient
org = "my-org"
bucket = "my-bucket"
token = $my-token
query = 'from(bucket: "my-bucket")\
|> range(start: -10m)\
|> filter(fn: (r) => r._measurement == "h2o_level")\
|> filter(fn: (r) => r._field == "water_level")\
|> filter(fn: (r) => r.location == "coyote_creek")'
Note - the syntax style for query can be in these 2 ways as mentioned here - https://community.influxdata.com/t/query-throws-rparen-got-eof-error/18940
I tried multiple ways as mentioned here How do I create a multiline Python string with inline variables? , but getting error.