Python Version - 2.7 InfluxDB Version - 1.5.0
I'm a newbie, and I am trying to connect my InfluxDB database with Python so I can write code for future projects.
I tested out the example program from this link. (Direct code below)
from influxdb import InfluxDBClient
json_body = [
{
"measurement": "cpu_load_short",
"tags": {
"host": "server01",
"region": "us-west"
},
"time": "2009-11-10T23:00:00Z",
"fields": {
"value": 0.64
}
}
]
client = InfluxDBClient('localhost', 8086, 'root', 'root', 'example')
client.create_database('example')
client.write_points(json_body)
result = client.query('select value from cpu_load_short;')
print("Result: {0}".format(result))
Upon running the program, I am receiving this error.
Traceback (most recent call last):
File "influxentryexample.py", line 19, in <module>
client.create_database('example')
File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 318, in create_database
status_code=201
File "/usr/lib/python2.7/dist-packages/influxdb/client.py", line 124, in request
raise InfluxDBClientError(response.content, response.status_code)
influxdb.client.InfluxDBClientError: 404: 404 page not found