influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
28.19k stars 3.51k forks source link

ApiException: 404 #25049

Open xinjaylin opened 3 weeks ago

xinjaylin commented 3 weeks ago

Hello, I try to use python to write data to influxdb, code like below: client = InfluxDBClient(url=url, token=token, org=org) write_api = client.write_api(write_options=SYNCHRONOUS) point = ( Point('measurement1') .tag('tagname1', 'tagval1') .field('field1', val) ) write_api.write(bucket=bucket, org=org, record=point) But I get "ApiException: (404)": Reason: Not Found HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json; charset=utf-8', 'X-Influxdb-Build': 'OSS', 'X-Influxdb- Version': 'v2.7.6', 'X-Platform-Error-Code': 'not found', 'Date': 'Mon, 10 Jun 2024 04:50:59 GMT', 'Content-Length': '68'}) HTTP response body: {"code":"not found","message":"bucket \"\u003cgg\u003e\" not found"} Any recommend or suggestion is appreciated! Thank you

xinjaylin commented 3 weeks ago
write_client = influxdb_client.InfluxDBClient(url=url, token=token, org=org)
bucket = '<gg>'
write_api = write_client.write_api(write_options=SYNCHRONOUS)
for val in range(5):
    point = (
        Point('measurement1')
        .tag('tagname1', 'tagval1')
        .field('field1', val)
    )
    write_api.write(bucket=bucket, org=org, record=point)
    time.sleep(1)
xinjaylin commented 3 weeks ago

ApiException: (404) Reason: Not Found HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json; charset=utf-8', 'X-Influxdb-Build': 'OSS', 'X-Influxdb-Version': 'v2.7.6', 'X-Platform-Error-Code': 'not found', 'Date': 'Mon, 10 Jun 2024 05:42:47 GMT', 'Content-Length': '68'}) HTTP response body: {"code":"not found","message":"bucket \"\u003cgg\u003e\" not found"}