json 파일을 로컬 호스트의 influxdb에 게시하려고합니다.상태 코드 400에서 게시판에 메시지가 유입됩니다.
{
"region" : "eu-west-1",
"instanceType": "m1.small"
}
내 반응은 다음과 같은 오류를 제공합니다 :
import json
import requests
url = 'http://localhost:8086/write?db=mydb'
files ={'file' : open('sample.json', 'rb')}
r = requests.post(url, files=files)
print(r.text)
이 sample.json
는 모습입니다 :
{"error":"unable to parse '--1bee44675e8c42d8985e750b2483e0a8\r':
missing fields\nunable to parse 'Content-Disposition: form-data;
name=\"file\"; filename=\"sample.json\"\r': invalid field
format\nunable to parse '\r': missing fields\nunable to parse '{':
missing fields\nunable to parse '\"region\" : \"eu-west-1\",': invalid
field format\nunable to parse '\"instanceType\": \"m1.small\"': invalid
field format\nunable to parse '}': missing fields"}
내 JSON은 유효한 JSON 파일 것 같다 이것은 코드입니다. 내가 뭘 잘못하고 있는지 모르겠다.
감사합니다.이 오류를 제거하는 데 도움이되었습니다. 그러나 이제 InfluxDB 오류가 발생합니다. - ""오류 : "데이터베이스가 필요합니다." –
@TracyAnnMonteiro,이 문제는 'InfluxDB'와 관련이 있습니다. 자세한 내용은 https://github.com/influxdata/influxdb/issues/2127 이며이 문제를 해결하는 데 도움이되는 정보는 다음 게시물에 있습니다. http://stackoverflow.com/questions/30227901/internal -server-in-entering-points-using-json-in-influxdb – coder