Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtoken is broken #21

Closed
ZhymabekRoman opened this issue Aug 29, 2021 · 5 comments
Closed

gtoken is broken #21

ZhymabekRoman opened this issue Aug 29, 2021 · 5 comments

Comments

@ZhymabekRoman
Copy link
Contributor

python
Python 3.9.6 (default, Aug 12 2021, 05:34:51)
[Clang 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489 on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from translatepy.utils.gtoken import TokenAcquirer
>>> acquirer = TokenAcquirer()
>>> tk = acquirer.do(text)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'text' is not defined
>>> text = "Hello"
>>> tk = acquirer.do(text)
Traceback (most recent call last):
  File "/data/sdext2/data/com.termux/files/home/git/translate/translatepy/utils/gtoken.py", line 106, in _update
    code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/sdext2/data/com.termux/files/home/git/translate/translatepy/utils/gtoken.py", line 242, in do
    self._update()
  File "/data/sdext2/data/com.termux/files/home/git/translate/translatepy/utils/gtoken.py", line 110, in _update
    raise Exception('Could not find TKK token for this request.\nSee https://github.com/ssut/py-googletrans/issues/234 for more details.')
Exception: Could not find TKK token for this request.
See https://github.com/ssut/py-googletrans/issues/234 for more details.
>>>
@Animenosekai
Copy link
Owner

Yea that's a problem from googletrans ( ssut/py-googletrans#234 ) and we could try to solve it but since Google changed their method of authenticating a user and managing sessions (the JSON RPC one we are using for GoogleTranslate) I don't think that it will work

@NawtJ0sh

This comment has been minimized.

@Animenosekai

This comment has been minimized.

@ZhymabekRoman
Copy link
Contributor Author

Google changed their method of authenticating a user and managing session

Ah, in that case maybe it makes sense to remove gtoken from translatepy completely? Or maybe make the old implementation separately in GoogleTranslateV3?

@Animenosekai
Copy link
Owner

Google changed their method of authenticating a user and managing session

Ah, in that case maybe it makes sense to remove gtoken from translatepy completely? Or maybe make the old implementation separately in GoogleTranslateV3?

I thought it would be fine to keep it, knowing that it will just raise an exception which will be catched.

Also, if this one is still on googletrans it should mean that it is still possible to use it in some way so why not keep it and if it works good if not well too bad it will just fall back to another endpoint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants