forked from platypush/platypush
[tts.mimic3
] Added timeout to requests.post
proxy.
This commit is contained in:
parent
faacbfd84f
commit
68c73fa181
1 changed files with 3 additions and 0 deletions
|
@ -5,6 +5,8 @@ from flask import abort, request, Blueprint
|
||||||
|
|
||||||
from platypush.backend.http.app import template_folder
|
from platypush.backend.http.app import template_folder
|
||||||
|
|
||||||
|
# Upstream /api/tts response timeout, in seconds
|
||||||
|
_default_timeout = 30
|
||||||
mimic3 = Blueprint('mimic3', __name__, template_folder=template_folder)
|
mimic3 = Blueprint('mimic3', __name__, template_folder=template_folder)
|
||||||
|
|
||||||
# Declare routes list
|
# Declare routes list
|
||||||
|
@ -35,6 +37,7 @@ def proxy_tts_request():
|
||||||
rs = requests.post(
|
rs = requests.post(
|
||||||
urljoin(args['server_url'], '/api/tts'),
|
urljoin(args['server_url'], '/api/tts'),
|
||||||
data=args['text'],
|
data=args['text'],
|
||||||
|
timeout=int(request.args.get('timeout', _default_timeout)),
|
||||||
params={
|
params={
|
||||||
'voice': args['voice'],
|
'voice': args['voice'],
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue