aamer
September 6, 2020, 2:18pm
1
Hello ,
Im getting this error when im trying to execute a flux query with python.
Python library : from influxdb_client import InfluxDBClient
Error : HTTP response body: b’Flux query service disabled. Verify flux-enabled=true in the [http] section of the InfluxDB config.\n’
i have changed flux-enabled to true in my config file but it still not working
can someone give me a help.
Thank you in advance.
HI @aamer , can you tell me what version of InfluxDB you are running? And also which Python client library (there are two: an old one and a new one)?
aamer
September 8, 2020, 8:32pm
3
Hello mhall
thank you for your answer
the version of influxdb im using is 1.8.1
and the python library is ## from influxdb_client import InfluxDBClient
but even in cli im trying to do some flux query like influx is not working and i get this error
That image looks like you’re inside the interactive influx
shell, not a normal terminal shell, so you don’t need to call influx
again
aamer
September 9, 2020, 8:26pm
5
thanks @mhall119 for the answer
do you have any idea of python problem what is the problem ?
I’m not convinced that the problem is in your python, but can you share your code anyway so I can give it a look?
aamer
September 13, 2020, 10:09am
8
@mhall119
from influxdb_client import InfluxDBClient
#Variables
host = ‘localhost’ #http://influxdb:8086/v2
port = 8086
user = ‘user’
password = ‘password’
database = ‘database’
protocol = ‘line’
org = ‘my-org’
bucket = ‘my-bucket’
#Query data on influxdb
query = ‘from(bucket: “my-bucket”)
|> range(start: -1000d)
|> filter(fn: ® => r._measurement == “measure”)
|> filter(fn: ® => r._field == “value”)
|> filter(fn: ® => r.agregation_method == “AVG”)’
#establish a connection
client = InfluxDBClient(url=“[http://localhost:8086](http://localhost:8086/)”, token=password, org=org)
#instantiate the WriteAPI and QueryAPI
query_api = client.query_api()
#return the table and print the result
result = client.query_api().query(org=org, query=query)
results =
for table in result:
for record in table.records:
results.append((record.get_value(), record.get_field()))
print(results)
aamer
September 15, 2020, 6:50pm
9
File “”, line 3, in raise_from
urllib3.exceptions.LocationParseError: Failed to parse: http://localhost:8086 /api/v2/query?org=my-org
Hi aamer- The problem doesn’t appear to be in your python or your flux. It looks like your config file’s settings are not being honored. Do you have
[http]
flux-enabled=true
in your config? Did you restart? Could there be another config file that’s being used instead?