Code Monkey home page Code Monkey logo

python-yandex-translate's Introduction

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)

python-yandex-translate's People

Contributors

dveselov avatar josxa avatar pplayground avatar severinus avatar tyrannosaurus avatar yrik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

python-yandex-translate's Issues

Warning yandex is no longer a free API

I have been using the yandex API for 4 years with this API and now they moved to a paid model.

Im just warning anyone out there who is researching using this web service and will close out this issue.

How to ignore 501 response?

cases such as '???' and ')' throw the

')' returned:

Traceback (most recent call last):
  File "C:/Users/6347463162413d3d/PycharmProjects/untitled/THIS IS WORKING.py", line 51, in <module>
    d = translate.detect(lastMsgRcvd)
  File "C:\Python36\lib\site-packages\yandex_translate\__init__.py", line 121, in detect
    raise YandexTranslateException(501)
yandex_translate.YandexTranslateException: ERR_LANG_NOT_SUPPORTED

japanse language

when use this for English to Japanese translation it gives output as

u'en-ja', u'text': [u'\u306e\u51fa\u529b\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306f\u8868\u793a\u3059\u3079\u3066\u306e\u30c6\u30ad\u30b9\u30c8\u5185\u306e\u30d5\u30a1\u30a4\u30eb\n\u540c\u3058\u30c6\u30ad\u30b9\u30c8\u307e\u305f\u306f\u901a\u8a33\u3092\u8ffd\u52a0\u3002\n\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u66f8\u3067\u3059\u3079\u3066\u306e\u884c\u304c\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3059\u3079\u3066\u8868\u793a\n'], u'code

how to translate it to Japanese

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.