wilfilho / bingtranslator Goto Github PK
View Code? Open in Web Editor NEWMicrososft Translator API for Python
License: GNU Lesser General Public License v3.0
Micrososft Translator API for Python
License: GNU Lesser General Public License v3.0
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,
The urlparse module is renamed to urllib.parse in Python 3.
import six
from six.moves import urllib
will fix this BUG.
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'))
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.