Influxdb2 Python API: Path not found

I have a working InfluxDb2 server and, on a Raspberry Pi, the Python client library. I’ve generated the the tokens in the server UI and copied an all-areas one into the Python. The test bucket is set up in the UI too. In the Python program I have this:

bucket = "test"
org = "test-org"

token = "blabla=="
# Store the URL of your InfluxDB instance

client = influxdb_client.InfluxDBClient(

Followed later by:

p = influxdb_client.Point("my_measurement").tag("location", "Prague").field("temperature", 25.3)
write_api = client.write_api(write_options=SYNCHRONOUS)
write_api.write(bucket='test', org='test-org', record=p)

I’ve overcome the not-authorized but now, whatever I do, I end up with this: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json; charset=utf-8', 'X-Influxdb-Build': 'OSS', 'X-Influxdb-Version': 'v2.2.0', 'X-Platform-Error-Code': 'not found', 'Date': 'Tue, 26 Apr 2022 14:35:50 GMT', 'Content-Length': '54'})
HTTP response body: {
    "code": "not found",
    "message": "path not found"

I’ve also gone back to Curl which gives me not authorized problem with the same parameters. Any help appreciated, beginning to regret trying to upgrade now.

Hi @Hugh_Barnard,

thanks for using our client.

Try to use URL without api/v2:



Thanks and thanks for quick reply, this is looking good, program doesn’t break, though I can’t see data at present. More when I’ve modified the Point to store the real data.

Try to check a timestamp of your data and correct time range in UI:

Maybe good to start a new topic for this. But, Reading the docs for the Point protocol:

Point("h2o_feet").tag("location", "coyote_creek").field("water_level", 1).time(1))
  • How to express multiple tags?
  • What’s in time(1), unix epoch or what? Need better example, I think?

Incidentally I used to use json for previous influx projects, but this one is high intensity, so I believe I should be using batched up points? Lots of questions, sorry.

I’m getting:
lvl=info msg=Unauthorized log_id=0a5ZUrPG000 error="toke in journalctl currently

Point("h2o_feet").tag("tag1", "a").tag("tag2", "b").field("water_level", 1).time(1))

Unix epoch. You can also use DateTime:

point1 = Point('test_precision') \
            .field('power', 10) \
            .tag('powerFlow', 'low') \
            .time(datetime.datetime(2020, 4, 20, 6, 30, tzinfo=datetime.timezone.utc), WritePrecision.S)

Here is an example: How to use RxPY to prepare batches for synchronous write into InfluxDB - influxdb-client-python/ at master · influxdata/influxdb-client-python · GitHub

Thanks for all this. I’ll try and be quiet and work for a while now…

Thanks for this, my data is coming out of a pipe, I need something a bit simpler for the moment. Looking at the code, a batch is pretty much:

[point1, point2 ...]

I could do that with a python append to list, then write it, as the example?

Yes, that’s a valid use case.

Thanks, probably go for something a bit more spiffy later. Just need to get the whole tool chain working first.