I want to send small pieces of text to a tts capable device. I preferably send the text as body from a POST request. What would be the easiest approach in doing this?
Python script. Then you can actually use requests.post. Unless this isnât what you mean.
r = requests.post(âhttp://httpbin.org/postâ, data = {âkeyâ:âvalueâ})
Thanx, that probably would have worked as well but I went with https://www.home-assistant.io/components/notify.rest/ . This suits my needs as well.
Iâm pretty sure rest uses the requests.post, so itâs essentially the same thing. I didnât even know about the rest component. TIL. There are way too many components to keep in mind!
I tried the python_script way.
> send = requests.post('http://' + ipaddr + ':8090/speaker', data=sendXML)
This is the result:
2019-05-16 21:28:02 ERROR (SyncWorker_19) [homeassistant.components.python_script.bosenotify.py] Error executing script: name ârequestsâ is not defined
Traceback (most recent call last):
File â/usr/local/lib/python3.7/site-packages/homeassistant/components/python_script/init.pyâ, line 159, in execute
exec(compiled.code, restricted_globals, local)
File âbosenotify.pyâ, line 14, in
NameError: name ârequestsâ is not defined
i cant âimport requestâ for security reasons. Any hint?