HTTP response body: b'Flux query service disabled. Verify flux-enabled=true in the [http] section of the InfluxDB config.\n'

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)?

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

image

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

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?

hello @mhall119

i send you the code

@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)

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?