Skip to content Skip to sidebar Skip to footer

Googletrans Not Detecting Language

Good morning everyone, I am using googleTrans in my code to translate a list of sentence. It worked perfectly until today. Now when I run it, it perceive everything as English and

Solution 1:

googletrans uses not the official API. It uses the Google Translate Ajax API. You can also read this in the docs. If you make too many requests, especially one right after another, you will be banned.

Turn on exceptions and you will see that you get the HTTP Error 429 Too Many Requests:

>>> from googletrans import Translator
>>> translator = Translator(raise_exception=True)
>>> print(translator.translate('हॅलो वर्ल्ड').text)
Traceback (most recent call last):
  ...
Exception: Unexpected status code "429"from ['translate.googleapis.com']

What can you do? Do not make too many requests or use the official API.

Post a Comment for "Googletrans Not Detecting Language"