dead py_translator?
opened this issue · comments
invoke py_translator.Translator().translate method, an error occured.
File "/usr/local/lib/python3.6/dist-packages/py_translator/client.py", line 172, in translate
data = self._translate(text, dest, src)
File "/usr/local/lib/python3.6/dist-packages/py_translator/client.py", line 75, in _translate
token = self.token_acquirer.do(text)
File "/usr/local/lib/python3.6/dist-packages/py_translator/gtoken.py", line 184, in do
self._update()
File "/usr/local/lib/python3.6/dist-packages/py_translator/gtoken.py", line 56, in _update
self.tkk = self.RE_TKK.findall(r.text)[0]
gtoken? right?
by the way, an error occurs also command line not only python code.
$ translate fr <<< 'I think therefore I am'
Traceback (most recent call last):
File "/home/user/projects/a_soft/venv/lib/python3.6/site-packages/translate/coroutines.py", line 170, in spool
stream = yield
GeneratorExit
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/projects/a_soft/venv/lib/python3.6/site-packages/translate/coroutines.py", line 145, in set_task
task = yield
GeneratorExit
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/projects/a_soft/venv/bin/translate", line 11, in <module>
sys.exit(main())
File "/home/user/projects/a_soft/venv/lib/python3.6/site-packages/translate/__main__.py", line 115, in main
return source(spool(set_task(translate, translit=args.translit)), args.text)
File "/home/user/projects/a_soft/venv/lib/python3.6/site-packages/translate/coroutines.py", line 204, in source
return target.close()
File "/home/user/projects/a_soft/venv/lib/python3.6/site-packages/translate/coroutines.py", line 180, in spool
iterable.close()
File "/home/user/projects/a_soft/venv/lib/python3.6/site-packages/translate/coroutines.py", line 149, in set_task
list(map(stream, workers.map(translator, queue)))
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 586, in result_iterator
yield fs.pop().result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/user/projects/a_soft/venv/lib/python3.6/site-packages/translate/translator.py", line 51, in connection
response.raise_for_status()
File "/home/user/projects/a_soft/venv/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 503 Server Error: Service Unavailable for url: https://translate.google.com/translate_a/single?client=a&ie=utf-8&oe=utf-8&dt=t&tl=fr&q=I+think+therefore+I+am%0A
gtoken
I've put up a PR to fix: #8
Library was updated https://github.com/markolofsen/py_translator
@markolofsen
Cannot use for free this update? (ver==2.0.1)
Must pay Google for getting creds.json
?
@falconws yes,
$20 per 1,000,000 characters*
https://cloud.google.com/translate/pricing
Before update this library I can use free.
And #8 pull req can use continue.
Why are you choose must pay plan?
@falconws because google relaunched a https://translation.google.com and I haven't a time for making new release with new parsers...
thank you for explain.
I see.
unfortunately I need research other free library
because I need free.
@markolofsen Did you take a look at #8?
@Guy-Dipietro-Bose google changed frontend of translate.google.com. Changes are using it?
Yes it addresses the original issue:
invoke py_translator.Translator().translate method, an error occured.
File "/usr/local/lib/python3.6/dist-packages/py_translator/client.py", line 172, in translate
data = self._translate(text, dest, src)
File "/usr/local/lib/python3.6/dist-packages/py_translator/client.py", line 75, in _translate
token = self.token_acquirer.do(text)
File "/usr/local/lib/python3.6/dist-packages/py_translator/gtoken.py", line 184, in do
self._update()
File "/usr/local/lib/python3.6/dist-packages/py_translator/gtoken.py", line 56, in _update
self.tkk = self.RE_TKK.findall(r.text)[0]
Thats cool. I'm changing right now new version in pypi-repo