dveselov / python-yandex-translate

Python module for Yandex.Translate API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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)

About

Python module for Yandex.Translate API

License:Do What The F*ck You Want To Public License


Languages

Language:Python 100.0%