From e84b87bec10594706decbf0db4a7ffed0d3948b2 Mon Sep 17 00:00:00 2001 From: hailong29 <1987616050@qq.com> Date: Tue, 4 Oct 2022 18:53:46 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A4=84=E7=90=86=E8=AE=AF=E9=A3=9Eapi,=20on?= =?UTF-8?q?=5Fclose=E5=8F=82=E6=95=B0=E4=B8=8D=E5=8C=B9=E9=85=8D=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hailong29 <1987616050@qq.com> --- autosub/api_xfyun.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autosub/api_xfyun.py b/autosub/api_xfyun.py index b33940b3..8caee10e 100644 --- a/autosub/api_xfyun.py +++ b/autosub/api_xfyun.py @@ -136,7 +136,7 @@ def __call__(self, filename): api_address=self.api_address), on_message=lambda web_socket, msg: self.on_message(web_socket, msg), on_error=lambda web_socket, msg: self.on_error(web_socket, msg), - on_close=lambda web_socket: self.on_close(web_socket), + on_close=self.on_close, on_open=lambda web_socket: self.on_open(web_socket)) self.web_socket_app.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE}) if self.is_full_result: @@ -165,7 +165,7 @@ def on_error(self, web_socket, error): # pylint: disable=no-self-use """ raise exceptions.SpeechToTextException(error) - def on_close(self, web_socket): # pylint: disable=no-self-use, unused-argument + def on_close(self, *args): # pylint: disable=no-self-use, unused-argument """ Process the connection close from WebSocket. """ @@ -233,4 +233,4 @@ def run(): # # print(web_socket_result_obj(filename=r".pcm")) # time2 = datetime.now() -# print(time2 - time1) +# print(time2 - time1) \ No newline at end of file