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 AI Translator
Azure AI Translator
An Azure service to easily conduct machine translation with a simple REST API call.
484 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 14,180 Reputation points MVP
    2023-12-09T15:55:23.4933333+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.