All Projects → dveselov → Python Yandex Translate

dveselov / Python Yandex Translate

Licence: wtfpl
Python module for Yandex.Translate API

Programming Languages

python
139335 projects - #7 most used programming language

python-yandex-translate Build Status

Python module for Yandex.Translate API.

This module is fully-compatible with Python 2.7+ and 3.3+ versions.

Installation

Use pip:

pip install yandex.translate

Usage

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.

License

WTFPL (Public Domain)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].