py-googletranslation
py-googletranslation copied to clipboard
Exception: Unexpected status code 429
Hi @Saravananslb Thanks for setting up a new translate library!
Unfortunately, even for a minimal working example:
from pygoogletranslation import Translator
translator = Translator()
translator.translate('Good Morning', dest='ta')
I run into this error:
Exception: Unexpected status code 429 from https://translate.google.com/_/TranslateWebserverUi/data/batchexecute after retried 3 loop with 5s delay
I upgraded to 'https://pypi.org/project/pygoogletranslation/2.0.2/' as mentioned in the closed issue, but it is still not working and throws the same error:
Exception: Unexpected status code 429 from https://translate.google.com/_/TranslateWebserverUi/data/batchexecute after retried 3 loop with 5s delay
Hi @Saravananslb Thanks for setting up a new translate library!
Unfortunately, even for a minimal working example:
from pygoogletranslation import Translator translator = Translator() translator.translate('Good Morning', dest='ta')I run into this error:
Exception: Unexpected status code 429 from https://translate.google.com/_/TranslateWebserverUi/data/batchexecute after retried 3 loop with 5s delayI upgraded to 'https://pypi.org/project/pygoogletranslation/2.0.2/' as mentioned in the closed issue, but it is still not working and throws the same error:
Exception: Unexpected status code 429 from https://translate.google.com/_/TranslateWebserverUi/data/batchexecute after retried 3 loop with 5s delay
could you please share the text that your are trying to translate. source lang and dest lang. please send it to [email protected] I will help you this issue.
Hi @Saravananslb that is a kind offer, however, my data is confidential and the translation directed to only some part of it that is embedded in a long function.
I hope that one of the packages py-googletranslation, google_trans_new or py-googletrans will fix their problems and I can run my code smoothly again.
Hi @jonas-nothnagel and @Saravananslb, I had the same issue also, just trying to trans a single sentence though. Has there been any update? But same code runs fine on Google colab.
Hi @jonas-nothnagel and @Saravananslb, I had the same issue also, just trying to trans a single sentence though. Has there been any update? But same code runs fine on Google colab.
Hi jsmboli,
Are u getting the same 429 error code.
Thanks, Saravanan
@JSMboli I still encounter the error. Actually, for each google-trans library I've tried (and there are several implementations on github) it does not seem to work well anymore. I assume that Google changed their API.
I also meet this error. I tried to translate the same sentence more than 100000 times to test its stability. It will throw such an error in the process. I guess there are too many requests to Google Translation.
Google Translate HTTP Error 429 too many requests
The HTTP 429 Too Many Requests response status code indicates the user has sent too many requests in a given amount of time ("rate limiting"). A Retry-After header might be included to this response indicating how long to wait before making a new request.
Not a solution for this issue, but perhaps it is helpful for you guys. I ended up using transformer based Neural Translation https://github.com/UKPLab/EasyNMT
It takes more time, but since it is a pre-trained model it is not dependent on some API we have no control over and the translation quality is fantastic.
@jonas-nothnagel, thanks for letting us know.
So I found a workaround:
translator = Translator()
translator.raise_Exception = True
try:
trans_obj = translator.translate(word_to_translate, src='he', dest=lang)
except Exception as err:
translator = Translator()
translator.raise_Exception = True
trans_obj = translator.translate(word_to_translate, src='he', dest=lang)
So when the exception is thrown I start a new object and try again. Worked for me.