While translating bulk text files to English using Googletrans it shows 'Could not find TKK token for this request'. What could be the reason?

Viewed 98

I am using google trans 4.0.0rc1. This is the code I am using:

from googletrans import Translator
translator = Translator()

for file_number in range(0, 50):
    f = open(f'train\\train_{file_number}.txt', 'r')

    if f.mode == 'r':
        contents = f.read()
        print(contents)

    result = translator.translate(contents, dest='en')
    with open(f'train\\trans_{file_number}.txt', 'w') as f:
        f.write(result.text)

And here is the error. The link mentioned in the error has no info on the TKK token stuff. What should I do?

 File "C:\Anaconda3\lib\site-packages\googletrans\gtoken.py", line 67, 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.
0 Answers
Related