Python module for Yandex.Translate API.
This module is fully-compatible with Python 2.7+ and 3.3+ versions.
Use pip
:
pip install yandex.translate
from yandex_translate import YandexTranslate
translate = YandexTranslate('Your API key here.')
print('Languages:', translate.langs)
print('Translate directions:', translate.directions)
print('Detect language:', translate.detect('Привет, мир!'))
print('Translate:', translate.translate('Привет, мир!', 'ru-en')) # or just 'en'
This will output:
Languages: {'en', 'el', 'ca', 'it', ..}
Translate directions: ['az-ru', 'be-bg', 'be-cs', ..]
Detect language: 'ru'
Translate: {'text': ['Hello, world!'], 'code': 200, 'lang': 'ru-en'}
Also, it's possible to use proxies when doing requests to Yandex.Translate API - just pass proxies
dictionary with data in same format that requests
use.
WTFPL (Public Domain)