Hi! I have a emoncms server on my Raspi and use an SD120c connected via modes in order to collect the data.
I have written this code in python:
import os
import time
import requests
while 1:
dati = os.popen("sdm120c -a 1 -b 2400 /dev/ttyUSB0 -q").read()
print dati
dati2 = "csv=" + dati
print dati2
# Send to emoncms
r = requests.post("http://10.0.1.16/emoncms/input/post.json?node=1", params=dati2)
print(r.url)
r.status_code == requests.codes.ok
time.sleep(5)
the url created by the program is correct but the emoncms server does not receive data... but if i try to copy and paste the url generated by the script in my browser, the server receive all data!!
where I'm wrong?
Thanks!
Re: senda data to Emoncms
It looks like you are missing an apikey, when you you C&P into browser chances are you are already logged in perhaps.
Paul
Re: senda data to Emoncms
The "read&write" APIkey of course. See the Input API Help for the key and the format.
Re: senda data to Emoncms
wow!!! Thanks!