401000 error when trying to use my key in python using deep_translator library

aakervall 0 Reputation points
2023-12-09T05:23:56.7233333+00:00

Hello! New to python and I am trying to use the deep_translator library for Microsoft Translator. I set up an API for Microsoft Translator in Azure and am using the following code in python:

text = "You got this!"

translatedtext = MicrosoftTranslator(api_key='myAPIkey_fromAzure', target='sv').translate(text=text)

However, I'm getting the following error. I've double checked the key multiple times...

MicrosoftAPIerror: Microsoft API returned the following error: {'code': 401000, 'message': 'The request is not authorized because credentials are missing or invalid.'}

Any ideas why?

Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
363 questions
{count} votes