python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

SpeechToTextV1.add_corpus() uses wrong http method (GET, should use POST)

Open alexchao opened this issue 9 years ago • 1 comments

Currently, using add_corpus will break with a WatsonException: Unknown error error. This is due to the method using the wrong HTTP method (GET, instead of POST). The tests don't catch this because the assertion in test_custom_corpora only checks the number of requests made and not the details of those requests.

I have a patch that should be ready soon.

alexchao avatar May 19 '17 21:05 alexchao

After changing the test to use responses assert_all_requests_are_fired flag, test fails:

E           AssertionError: Not all requests have been executed [('POST', 'https://stream.watsonplatform.net/speech-to-text/api/v1/customizations/customid/corpora/corpus'), ('DELETE', 'https://stream.watsonplatform.net/speech-to-text/api/v1/customizations/customid/corpora/corpus')]

env/lib/python3.5/site-packages/responses.py:304: AssertionError

alexchao avatar May 19 '17 21:05 alexchao