The src attribute is supposed to be a URL where an audio file can be found.
If your unirest call retrieves an audio file, you would have to set up a
separate controller action to retrieve the file via unirest and then stream
it via response.stream -- the URL of *that* action would go in the src
attribute.
Anthony
On Friday, April 8, 2016 at 8:35:21 AM UTC-4, Stephen Duisberg wrote:
>
> def index():
> # These code snippets use an open-source library.
> response_post = unirest.post("
> https://voicerss-text-to-speech.p.mashape.com/?key=key1",
> headers={
> "X-Mashape-Key": "key2",
> "Content-Type": "application/x-www-form-urlencoded"
> },
> params={
> "c": "mp3",
> "f": "44khz_16bit_mono",
> "hl": "en-us",
> "r": 0,
> "src": "Hello, world!"
> }
> )
> return locals()
>
> {{extend 'layout.html'}}
> <audio controls>
> <source src="{{=response_post}}" type="audio/mpeg">
> unsupported
> </audio>
> <br>
> {{=response_post.body}}
>
>
> I verified that response_post has the correct body. I guess the problem
> lies in the tag: source src="{{what to do here}}"
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.