A python wrapper around the Yandex API

pip install yandex==0.0.2



Build Status Codacy Badge License: MIT Documentation Status

A python wrapper around the Yandex API


Create a file named "" in the tests/ folder, and paste in the following :

API_KEY = "<your_api_token_here>"

You can get an API token here


Instantiate the Yandex object with your API token. You can then use the translate method to translate text from one language to another.

from yandex import Yandex

tr = Yandex("MY_API_TOKEN")
tr.translate("Hello World", "fr")
tr.translate("Bonjour tout le monde!", to_lang="en", from_lang="fr")

Yandex can detect which language the text is in, therefore, the from_lang argument is optional. You can also translate text formatted in html

tr.translate("<p>Hello World!</p>", "fr", format="html")

Or you can use the API to guess a language from a text sample :

tr.guess_language("Hello World!")

You can get a list of all available language code pairs with the get_language_pairs method, and a dictionary mapping all the language codes to their names with the get_language_map method