Microsoft Translator API wrapper
Project description
Installation
Install with pip:
$ pip install mstranslator
Usage
1. Subscribe to the Microsoft Translator API Subscribe to the Microsoft Translator dataset on Azure Marketplace. Note that subscriptions, up to 2 million characters a month, are free. Translating more than 2 million characters per month requires a payment.
2. Register an application Register an application here. As the redirect field is not used but it’s marked as required you may enter any URI to pass validation.
That’s all. Now you have a Client ID and Client secret.
Example Usage:
>>> from mstranslator import Translator
>>> translator = Translator('<Client ID>', '<Client secret>')
>>> print(translator.translate('Привет, мир!', lang_from='ru', lang_to='en'))
Hello World!
Testing
To run tests you need to set TEST_MSTRANSLATOR_CLIENT_ID and TEST_MSTRANSLATOR_CLIENT_SECRET environment variables and install tox package. After that run shell command:
$ tox
History
0.2.1 (2013-05-04)
Added get_lang_names method
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.