Python example?
Hi learned folk,
Does anyone have a primitive example of a python/requests integration with this api to save me the pain of working this out from scratch?
Tia
Mark
0
Hi learned folk,
Does anyone have a primitive example of a python/requests integration with this api to save me the pain of working this out from scratch?
Tia
Mark
Comments
Hi Upstairserics,
I actually have a Python example on hand as this is what I use to test/troubleshoot things most often myself - hope this helps:
Superb, many thanks. A big accelerator.
Thanks too,
could the url be replaced by a path like c:/music/bell.mp3?
An other question: Does extension/File have to be mp3?
In the use case where we want to interrupt the playing stream with a 'notification' (think...the mp3 output file from a TTS operation) then not having to run a web server to serve up the file would be useful.
I've got the example above working ok, so I'm going to try a file path but for some reason I'm not expecting it to work.
Stay tuned
i can stream all i want Thanks! Now i'm thinking about the 3s lag (i have to put a lag on my computer to hear the music on the same time on the soundtouch)
My effort using the notification api

I can answer this one. As per the API documentation :
Supported file types:
Hi,
I tried that example and this is what I get:
'<?xml version="1.0" ?>\n<Error name="HTTP_STATUS_FORBIDDEN" severity="Unknown" value="403">unsupported device</Error>\n'
Could it be my API key isn't good? I used the consumer key for an app I created. This message didn't sound so good:
Below are keys you can use to access the API products associated with this application (Test). The actual keys need to be approved and approved for an API product to be capable of accessing any of the URIs defined in the API product.
Thanks,
Bill
Hi Fabnavigator,
That error is returned when attempting to use Audio Notifications on a SoundTouch product that does not yet support the capability. The only supported products today are SoundTouch 10, SoundTouch 20 Series III, and SoundTouch 30 Series III - sending a POST to /speaker for any product other than one of those three will return the 403 error you are seeing. Can you confirm you are using one of those three products? If you are, we can look to troubleshoot further.
By the way, if your API key is not good, you would receive a 401 HTTP_STATUS_UNAUTHORIZED error rather than the 403 HTTP_STATUS_FORBIDDEN error you are seeing, so I believe your key is OK.
Works perfectly with my SoundTouch 20.
Thanks,
Bill