This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pushing data from Python to SignalK?
#1
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.
 
  • 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?
Reply


Messages In This Thread
Pushing data from Python to SignalK? - by TomSailor - 2020-07-07, 09:07 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)