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

fix: update microsoft provider api #63

Merged
merged 2 commits into from
Jan 18, 2021
Merged

Conversation

pringon
Copy link
Contributor

@pringon pringon commented Jan 18, 2021

This closes #58 and closes #59

Nice library, simple and intuitive client-facing API. 😄

I tried using the Microsoft provider but was getting the error described in the issues above. After some digging, I realised that the Microsoft Translator API has since been updated and the location of it has moved.

This PR contains the changes that got it working for me. Hope it helps!

An example of how to use the provider:

from translate import Translator

AZURE_TRANSLATE_SECRET = <your-api-key>

translator = Translator(
  to_lang="en", from_lang="autodetect", provider="microsoft",
  secret_access_key=AZURE_TRANSLATE_SECRET, region="europewest"
)

print(translator.translate("e pur si muove"))
# Output should be: and even though it moves

@terryyin
Copy link
Owner

Thanks! It looks like the API has changed quite a lot!

@terryyin terryyin merged commit 737afc4 into terryyin:master Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants