From 75b1119444492b51940e0c6baafc9e574e3a79a8 Mon Sep 17 00:00:00 2001 From: "Dr. Bryson Payne" <31050414+brysonpayne@users.noreply.github.com> Date: Sat, 10 Nov 2018 11:11:18 -0500 Subject: [PATCH] Update __init__.py Update to use new Bing credential and recognition URLs - Microsoft is phasing out Bing Speech API, moving to Cognitive Services Speech API. The two URLs above work for demo Speech API keys after 11/1/2018. --- speech_recognition/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/speech_recognition/__init__.py b/speech_recognition/__init__.py index c104390a..ab2b41d6 100644 --- a/speech_recognition/__init__.py +++ b/speech_recognition/__init__.py @@ -1048,7 +1048,7 @@ def recognize_bing(self, audio_data, key, language="en-US", show_all=False): allow_caching = False # don't allow caching, since monotonic time isn't available if expire_time is None or monotonic() > expire_time: # caching not enabled, first credential request, or the access token from the previous one expired # get an access token using OAuth - credential_url = "https://api.cognitive.microsoft.com/sts/v1.0/issueToken" + credential_url = "https://westus.api.cognitive.microsoft.com/sts/v1.0/issueToken" credential_request = Request(credential_url, data=b"", headers={ "Content-type": "application/x-www-form-urlencoded", "Content-Length": "0", @@ -1076,7 +1076,7 @@ def recognize_bing(self, audio_data, key, language="en-US", show_all=False): convert_width=2 # audio samples should be 16-bit ) - url = "https://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?{}".format(urlencode({ + url = "https://westus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?{}".format(urlencode({ "language": language, "locale": language, "requestid": uuid.uuid4(),