A really simple noob question. How do I place variables in this json_body variable? The problem is with all the quotation marks. I can't use the .format string method for this as the json_body variable isn't holding a simple string.
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)
Source: https://github.com/influxdata/influxdb-python#examples
So, for example, how do I get a variable in there, e.g.
"value": 0.64
to:
"value": variable_name?
In the example code, all values are hard-coded.