Coder Social home page Coder Social logo

bingtranslator's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

bingtranslator's Issues

Example is not working

Hi,

I'm a french user of BingTranslator, and it's not working :

#!/usr/bin/python
# -*-coding:UTF-8 -*

from BingTranslator import Translator #importing Translator class for translations.

client_id = "test"
client_secret = "test"

translator = Translator(client_id, client_secret)
phrase_translated = translator.translate("Hello World", "pt") #translating phrase
print (phrase_translated)

And :

jeo@jes:~$ ./t.py 
Traceback (most recent call last):
  File "./t.py", line 10, in <module>
    phrase_translated = translator.translate("Hello World", "pt") #translating phrase
  File "/usr/local/lib/python2.7/dist-packages/BingTranslator/__init__.py", line 277, in translate
    mode_translate = TranslatorMode.Translate.value
AttributeError: 'str' object has no attribute 'value'

jeo@jes:~$ python 
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
>>> import sys
>>> print (sys.version) 
2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2]

Any idea ?

Regards,

Not work in Python 2.x

The urlparse module is renamed to urllib.parse in Python 3.
import six
from six.moves import urllib
will fix this BUG.

Does not work

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Base Terminal 01\Documents\GitHub\project_kotori\translatortest.py", line 6, in <module>
    translated = translator.translate("Hello World", "pt")
  File "C:\Users\Base Terminal 01\.virtualenvs\project_kotori-pMOVl_v2\lib\site-packages\BingTranslator\__init__.py", line 278, in translate
    return self._get_content(infos_translate, mode_translate)
  File "C:\Users\Base Terminal 01\.virtualenvs\project_kotori-pMOVl_v2\lib\site-packages\BingTranslator\__init__.py", line 218, in _get_content
    token = self._get_token()
  File "C:\Users\Base Terminal 01\.virtualenvs\project_kotori-pMOVl_v2\lib\site-packages\BingTranslator\__init__.py", line 186, in _get_token
    token = requests.post(oauth_url, informations).json()
  File "C:\Users\Base Terminal 01\.virtualenvs\project_kotori-pMOVl_v2\lib\site-packages\requests\api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "C:\Users\Base Terminal 01\.virtualenvs\project_kotori-pMOVl_v2\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\Base Terminal 01\.virtualenvs\project_kotori-pMOVl_v2\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Base Terminal 01\.virtualenvs\project_kotori-pMOVl_v2\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Base Terminal 01\.virtualenvs\project_kotori-pMOVl_v2\lib\site-packages\requests\adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='datamarket.accesscontrol.windows.net', port=443): Max retries exceeded with url: /v2/OAuth2-13 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001D8F8D1FF70>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

get the detected language name ?

hello i would need a good translator which can, when i give a word , give me all translate but also give me the language source is it possible? I hope so !
by the way its the first translator i see which can give all the translation possible of a word directly at same time by detect. Thats a nice things really.
ex :
from_language=« autodetect »,to_language=« fr »;
eat ->manger (FROM english)
Nathan

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.