Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft API fails #98

Open
mrx23dot opened this issue Jun 2, 2022 · 1 comment
Open

Microsoft API fails #98

mrx23dot opened this issue Jun 2, 2022 · 1 comment

Comments

@mrx23dot
Copy link

mrx23dot commented Jun 2, 2022

translator = Translator(provider='microsoft', secret_access_key='KEY1....', to_lang='eng',
from_lang='ch')

fails with

    return ' '.join(self.provider.get_translation(text_wraped) for text_wraped in text_list)
  File "C:\py38_64\lib\site-packages\translate\providers\microsoft.py", line 47, in get_translation
    raise TranslationError(data["error"]["message"])
translate.exceptions.TranslationError: The request is not authorized because credentials are missing or invalid.
@MattFellows
Copy link
Contributor

For future sumblers upon this issue, I had this too - I had to modify the command to pass the region - in fact because I was doing this from the commandline - I had to modify main.py to allow passing the --region flag. Basically when you set up the Translator in Azure you choose a region and unless the Ocp-Apim-Subscription-Region header matches, you get an authentication error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants