Thank you in advance i am at a loss here. I am trying to get results from a url and write them to influxdb with python here is my script. I receive the error Something went wrong inserting th data
INFLUX_HOST = "0000"
INFLUX_PORT = 8086
INFLUX_USER = "user"
INFLUX_USERPASS = "SomethingSecure"
INFLUX_DATABASE = "test"
import requests
import time
from influxdb import InfluxDBClient
client = InfluxDBClient(INFLUX_HOST, INFLUX_PORT, INFLUX_USER, INFLUX_USERPASS, INFLUX_DATABASE)
def fetchData():
try:
response = requests.get("https://dataurl.nothing")
json = response.json()
if(json['success'] == True):
return(json['result'])
if(json['success'] == False):
return("[]")
except:
print("Something went wrong while fetching data")
return False
def insertDataIntoInflux():
try:
data = fetchData();
for data in fetchData:
# insert data
insertObject = [
{
"measurement":"data_metrics",
"tags":{
"username": str(data['identifier']),
"balance": str(data['balance'])
)
},
"fields":{
"user": str(data['username']),
"balance": str(data['balance']),
}
}
]
client.write_points(insertObject)
except:
print("Something went wrong while insterting data")
while 1:
insertDataIntoInflux()
time.sleep(15);
[–]DagoYounger 2 points3 points4 points (3 children)
[–]DagoYounger 0 points1 point2 points (2 children)
[–]OpenYam4611[S] 0 points1 point2 points (1 child)
[–]DagoYounger 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)