Python Script for InfluxDB API - need some assistance

We have some code in python that we are unable to get running due to some odd errors that I cannot make out.

This is the snippet of code:

INFLUX_CONFIG_ASR920 = '/opt/light_prophet/influx_config_snmp_asr920_optical.yml'

with open(INFLUX_CONFIG_ASR920) as f:
    config_asr920 = yaml.load(f, Loader=yaml.FullLoader)

def get_influx_client_asr920():
    influx_client_asr920 = influxdb_client.InfluxDBClient(

def query_agent_hosts():
    query_asr920 = 'import "influxdata/influxdb/schema"\
                    |> schema.tagValues (\
                    |>    bucket: "bucket_snmp_asr920_optical"\
                    |>    tag: "ASR920-Hostname"\
    influx_client_asr920 = get_influx_client_asr920()
    result = influx_client_asr920.query(query_asr920, epoch='m').get_points()
    agent_hosts = [i['value'].split('.')[0] for i in result]

We get an error when running this .py script per following:

Traceback (most recent call last):
  File "", line 57, in <module>
    feed = make_feed()
  File "", line 27, in make_feed
    hosts = optical_dataframe.list_reachable_hosts()
  File "/opt/light_prophet/", line 302, in list_reachable_hosts
    agent_hosts = query_agent_hosts()
  File "/opt/light_prophet/", line 211, in query_agent_hosts
    result = influx_client_asr920.query(query_asr920, epoch='m').get_points()
AttributeError: 'InfluxDBClient' object has no attribute 'query'

I am not sure how this is true as that is what is references in the influxdb python api guide when running a query. per these articles.

Use the InfluxDB Python client library | InfluxDB Cloud (TSM) Documentation (
API Documentation — InfluxDB 5.3.1 documentation (

Any help or recommendations would be greatly appreicated.

Thank you all.