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

error in googletrans 4.0.0rc1 translator #257

Closed
DanilKonon opened this issue Dec 10, 2020 · 19 comments · Fixed by #275 or #281
Closed

error in googletrans 4.0.0rc1 translator #257

DanilKonon opened this issue Dec 10, 2020 · 19 comments · Fixed by #275 or #281
Assignees

Comments

@DanilKonon
Copy link

I tried the new version of googletrans 4.0.0rc1.

translator = Translator(service_urls=['translate.google.com'])
res = translator.translate(text)

After some time an exception occurs:
AttributeError: 'Translator' object has no attribute 'raise_Exception'

To fix this I need to execute this line:

translator.raise_Exception = True

And then the exception writes: Exception: Unexpected status code "429" from ['translate.google.com']

@ssut ssut self-assigned this Dec 10, 2020
@setragw
Copy link

setragw commented Dec 18, 2020

Happened to me as well. When I try to do either multiple translator.detect(), it occured

@velocityCavalry
Copy link

Same happened to me as well when executing the code snippet below:

def google_translate(word, code):
    translator = Translator()
    translator.raise_Exception = True
    translated = translator.translate(word, src=code, dest='en').text
    return translated

@1nexoravel
Copy link

1nexoravel commented Jan 9, 2021

Hello there, error 429 (Too Many Requests) it is a problem between your external IP and google.
Just restart the Modem to change the IP.

Ok, not effective at all.

@emirpie2021
Copy link

Hi, I just used time.sleep(1) in translation loop. It gives more coffee time, works for me.

@jonas-nothnagel
Copy link

I have the same problem and even with changing IPs I am running into error 429. Is there a fix yet?

@haofanwang
Copy link

I also meet this problem.

@feihongloveworld
Copy link

same to me

@jonas-nothnagel
Copy link

Not a solution for this issue, but perhaps still helpful. 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.

@jonbesga
Copy link

jonbesga commented Feb 4, 2021

I'm having this issue as well. Is there any fix coming up?

@SzczurekYT
Copy link

Me too have this issue, any fix?

@Perezmarc
Copy link

Same here

@DLesmes
Copy link

DLesmes commented Mar 5, 2021

x100!!

I made more than 400 queries in a list comprehension perfectly it was ok and then I made another loop and the 'raise_Exception' appear again

some clue??

@stale
Copy link

stale bot commented May 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 9, 2021
@stale stale bot closed this as completed May 17, 2021
@EamonJarrett-Mann
Copy link

Wanted to comment so other people don't have to perform another search: currently google translate API allows 5 calls/second, caps it at 200k a day

@Rocky-04
Copy link

sleep(0.3)

@sachin-suresh-rapyuta
Copy link

Not a solution for this issue, but perhaps still helpful. 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.

How to translate .po files using this?

@sachin-suresh-rapyuta
Copy link

Hi, I just used time.sleep(1) in translation loop. It gives more coffee time, works for me.

Where do we add the time.sleep(1)?

@iHarshitTyagi
Copy link

The error "Exception: Unexpected status code "429" from ['translate.google.com']", you're getting because the function sent too many requests in a short span of time to google translate API.
time.sleep(1) basically add 1 second between the executions. It doesn't necessarily be 1 you can supply time.sleep(0.1) in the function itself.

@SantiDianaClibrain
Copy link

Hi! Did time.sleep() work to anyone to make "infinite" requests to the google translate API?

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

Successfully merging a pull request may close this issue.