chaoshome
(chaoshome)
January 4, 2021, 3:45pm
1
I’m currently using python to update an item in a simple script like this:
r = requests.get(url, headers = {"accept" : "application/json"})
requests.post(url, headers = {"accept" : "application/json"}, data = str(value))
This does not work anymore, as Openhab 3 requires authentication for API access.
Does anyone know how to do this?
HABapp does that well using Python 3.
chaoshome
(chaoshome)
January 5, 2021, 7:28pm
4
Thanks for your tipps, I have it working now.
Step 1: Create a token
This is done in the profile (click on the your login at the lower left corner of main ui)
Step 2:
Use the token like this:
r = requests.get(url, headers = {"Content-type": "text/plain", "accept" : "application/json", "Authorization": "Bearer %s" % token})