From 8e340d27659af4d72b3da7095a8dce349a71d0e3 Mon Sep 17 00:00:00 2001 From: Arne <44215085+arne-kapell@users.noreply.github.com> Date: Fri, 4 Aug 2023 20:26:48 +0000 Subject: [PATCH] fix(tts,stt,version): unpinned websocket-client fixes #810 and adds support for up to latest websocket-client (1.6.1) --- ibm_watson/websocket/recognize_listener.py | 2 +- ibm_watson/websocket/synthesize_listener.py | 2 +- requirements-dev.txt | 2 +- requirements.txt | 2 +- setup.py | 2 +- test/integration/test_speech_to_text_v1.py | 2 +- test/integration/test_text_to_speech_v1.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ibm_watson/websocket/recognize_listener.py b/ibm_watson/websocket/recognize_listener.py index c0d988c5..43eb7961 100644 --- a/ibm_watson/websocket/recognize_listener.py +++ b/ibm_watson/websocket/recognize_listener.py @@ -227,7 +227,7 @@ def on_error(self, ws, error): """ self.callback.on_error(error) - def on_close(self, ws): + def on_close(self, ws, *args): """ Callback executed when websocket connection is closed diff --git a/ibm_watson/websocket/synthesize_listener.py b/ibm_watson/websocket/synthesize_listener.py index dee6e28a..33caf81d 100644 --- a/ibm_watson/websocket/synthesize_listener.py +++ b/ibm_watson/websocket/synthesize_listener.py @@ -120,7 +120,7 @@ def on_error(self, ws, error): """ self.callback.on_error(error) - def on_close(self, ws, **kwargs): + def on_close(self, ws, *args, **kwargs): """ Callback executed when websocket connection is closed diff --git a/requirements-dev.txt b/requirements-dev.txt index 086cfe4e..f04883ea 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -17,4 +17,4 @@ Sphinx==3.5.2 bumpversion==0.6.0 # Web sockets -websocket-client==1.1.0 +websocket-client>=1.1.0 diff --git a/requirements.txt b/requirements.txt index 7df31b85..461b8746 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ requests>=2.0,<3.0 python_dateutil>=2.5.3 -websocket-client==1.1.0 +websocket-client>=1.1.0 ibm_cloud_sdk_core>=3.3.6, == 3.* diff --git a/setup.py b/setup.py index f3372074..6d47ba20 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ version=__version__, description='Client library to use the IBM Watson Services', packages=['ibm_watson'], - install_requires=['requests>=2.0, <3.0', 'python_dateutil>=2.5.3', 'websocket-client==1.1.0', 'ibm_cloud_sdk_core>=3.3.6, == 3.*'], + install_requires=['requests>=2.0, <3.0', 'python_dateutil>=2.5.3', 'websocket-client>=1.1.0', 'ibm_cloud_sdk_core>=3.3.6, == 3.*'], tests_require=['responses', 'pytest', 'python_dotenv', 'pytest-rerunfailures'], license='Apache 2.0', author='IBM Watson', diff --git a/test/integration/test_speech_to_text_v1.py b/test/integration/test_speech_to_text_v1.py index c0e0d186..808a8847 100644 --- a/test/integration/test_speech_to_text_v1.py +++ b/test/integration/test_speech_to_text_v1.py @@ -140,7 +140,7 @@ def on_transcription(self, transcript): interim_results=False, low_latency=False) assert test_callback.error is None assert test_callback.transcript is not None - assert test_callback.transcript[0][0]['transcript'] == 'isolated tornadoes ' + assert test_callback.transcript[0][0]['transcript'] in ['isolated tornadoes ', 'isolated tornados '] assert test_callback.transcript[1][0]['transcript'] == 'and heavy rain ' def test_on_transcription_interim_results_true(self): diff --git a/test/integration/test_text_to_speech_v1.py b/test/integration/test_text_to_speech_v1.py index d0eee91a..407abd68 100644 --- a/test/integration/test_text_to_speech_v1.py +++ b/test/integration/test_text_to_speech_v1.py @@ -163,7 +163,7 @@ def on_close(self): 'She sells seashells by the seashore', test_callback, accept='audio/wav', - voice='en-AU_CraigVoice') + voice='en-GB_JamesV3Voice') assert test_callback.error is None assert test_callback.fd is not None assert os.stat(file).st_size > 0