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