Status code 400 on post message to influxdb
<p>I'm trying to post a json file to influxdb on my local host. This is the code:</p>

<pre><code>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)
</code></pre>

<p>This is what <code>sample.json</code> looks like:</p>

<pre><code>    {
            "region" : "eu-west-1",
            "instanceType": "m1.small"
    }
</code></pre>

<p>My response gives the following errors:</p>

<pre><code> {"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"}
</code></pre>

<p>My json seems to be a valid json file. I am not sure what I am doing wrong. </p>