Skip to content
New issue

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

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

Already on GitHub? # to your account

Tkk token not found #429

Open
2 of 6 tasks
choppeh opened this issue Dec 8, 2024 · 0 comments
Open
2 of 6 tasks

Tkk token not found #429

choppeh opened this issue Dec 8, 2024 · 0 comments

Comments

@choppeh
Copy link

choppeh commented Dec 8, 2024

Googletrans version:

  • 4.0.0rc1
  • 3.1.0a0
  • 3.0.0
  • 2.x

I'm submitting a ...

  • bug report
  • feature request

Current behavior:

>>> from googletrans import Translator
>>> translator = Translator()
>>> translator.translate('안녕하세요.')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/danroxha/Workspace/translate/lib64/python3.11/site-packages/googletrans/client.py", line 182, in translate
    data = self._translate(text, dest, src, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/danroxha/Workspace/translate/lib64/python3.11/site-packages/googletrans/client.py", line 78, in _translate
    token = self.token_acquirer.do(text)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/danroxha/Workspace/translate/lib64/python3.11/site-packages/googletrans/gtoken.py", line 194, in do
    self._update()
  File "/home/danroxha/Workspace/translate/lib64/python3.11/site-packages/googletrans/gtoken.py", line 62, in _update
    code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'

Expected behavior:

Working README example

Steps to reproduce:

  • Create a venv with python3.11;
  • Install package with: pip install googletrans;
  • Open python REPL;
  • Follow the README sample

Related code:

from googletrans import Translator

translator = Translator()
translator.translate('안녕하세요.')

Other information:

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

No branches or pull requests

1 participant