2020-07-07, 09:07 PM
Hello,
I am facing a problem with pushing data from Python to SignalK, which I cannot solve (although I think the solution might be trivial):
I am collecting data (e.g. from a sensor) in Python and want send them to SignalK using the Python Requests post() or put() method, but none of them is working.
Here is the code I use:
I also experience the same error messages when I use "curl PUT ..." or "curl POST ..." from the terminal...
Can anybody give me a hint what I might do wrong here?
I am facing a problem with pushing data from Python to SignalK, which I cannot solve (although I think the solution might be trivial):
I am collecting data (e.g. from a sensor) in Python and want send them to SignalK using the Python Requests post() or put() method, but none of them is working.
- When I use the post() method, I get error 404 with the message: “Cannot POST /signalk/v1/api/vessels/self/environment/test/temperature”
- When I use the put() method, I get error 405 with: “PUT not supported for environment.test.temperature”
Here is the code I use:
Code:
import requests
LOGIN2 = {"username":"name","password":"pwd”}
DATA3 = {"value":1.52, "source":"anysource"}
url1 = 'http://localhost:3000/signalk/v1/auth/login'
url2 = 'http://localhost:3000/signalk/v1/api/vessels/self/environment/cpu/temperature'
r = requests.post(url=url1, json=LOGIN2)
cookie = r.cookies
while True:
r = requests.post(url = url2, data = DATA3, cookies=cookie)
# r = requests.put(url = url2, data = DATA3, cookies=cookie)
I also experience the same error messages when I use "curl PUT ..." or "curl POST ..." from the terminal...
Can anybody give me a hint what I might do wrong here?