No Data in UI After Python Script Write

Hi everyone,

I’m encountering an issue with writing data to an InfluxDB instance running in a Docker container ( (influxdb:latest) on another machine within my local network. I’m using the InfluxDB Python client.

I can access the InfluxDB UI through a web browser at http://ip_other_machine:8086, so network connectivity seems fine.

Here’s the Python script I’m using to write data:

 from datetime import datetime
 from influxdb_client import InfluxDBClient, Point, WritePrecision
 
 # InfluxDB credentials and details
 influxdb_host = 'http://ip_other_machine:8086'
 token = 'TOKEN'
 org = 'My_ORG'
 bucket = 'MY_BUCKET'
 
 # Initialize InfluxDB client
 with InfluxDBClient(url=influxdb_host, token=token, org=org) as client:
     write_api = client.write_api()
 
     # Create a Point structure
     point = Point("test_measurement") \
         .tag("location", "test_location") \
         .field("value", 123.45) \
         .time(datetime.utcnow(), WritePrecision.NS)
 
     # Write data to InfluxDB
     try:
         write_api.write(bucket=bucket, record=point)
         print("Data sent to InfluxDB successfully.")
     except Exception as e:
         print(f"Error sending to InfluxDB: {e}")

The script executes without errors and indicates “Data sent to InfluxDB successfully.” However, when I check the InfluxDB UI, no data appears.

I’ve confirmed that the token used has write permissions for the bucket ‘[MY_BUCKET]’.
I’m not sure what I’m doing wrong and would appreciate any insights or suggestions!

Thanks in advance!

Hello @LuisOliveira,
Hmm that’s quite odd.
How are you querying for the data?
Are you able to perform a simple cURL request?

1 Like

First of all, thanks for the reply @Anaisdg

After testing with Postman and confirming that I was able to write data, I changed the python script to something similar to the logic displayed at the node.js documentation and it worked. Still no idea why the first script didn’t worked

Now I’m trying to apply that logic to a scrip that gets the data from RabbiMQ and write it at the InfluxDB instance running in a Docker container ( (influxdb:latest) on another machine and containerize it that scrip.

Thanks again