desbma / GoogleSpeech

Read text using Google Translate TTS API
GNU Lesser General Public License v2.1
161 stars 37 forks source link

HTTPError: 503 Server Error #2

Closed gracht23 closed 8 years ago

gracht23 commented 8 years ago

Running the example gives me the next error:

domotica@raspberrypi ~ $ google_speech -l en "Hello $USER, it is $(date)" Exception in thread PreloaderThread-0: Traceback (most recent call last): File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner self.run() File "/usr/local/lib/python3.4/dist-packages/google_speech/init.py", line 45, in run segment.preLoad() File "/usr/local/lib/python3.4/dist-packages/google_speech/init.py", line 181, in preLoad audio_data = self.download(url) File "/usr/local/lib/python3.4/dist-packages/google_speech/init.py", line 230, in download response.raise_for_status() File "/usr/local/lib/python3.4/dist-packages/requests/models.py", line 837, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 503 Server Error: Service Unavailable for url: https://translate.google.com/translate_tts?client=t&ie=UTF-8&idx=0&total=1&textlen=51&tl=en&q=hello+domotica%2C+it+is+sat+24+oct+02%3A27%3A48+cest+2015

desbma commented 8 years ago

I can not reproduce, this example works fine here. Are you behind a proxy? On a shared computer? Did you call google_speech several times before getting this error? Sometimes the Google server blocks your IP for a few minutes if you send too much queries. If you open the url above in a browser, what do you get?

gracht23 commented 8 years ago

I did call google_speech several times. That explaines the error. Opening the url gives a correct played voice from Google.

desbma commented 8 years ago

Can you confirm the error is gone if you call google_speech only a few times at a time?

glutanimate commented 8 years ago

Hey guys,

I stumbled on this bug report and thought I might be able to help:

I was running into the same issue with my project a while ago. It seems like Google changed the Translate API to require a new parameter (tk). Any requests without this parameter quickly result into a rate limitation. I eventually found a workaround by supplying a random tk value. Here it's implemented in python.

Anyway, I hope this helps with solving the error.

desbma commented 8 years ago

Thanks for the tip @Glutanimate, I had noticed they had tightened their rate limit, but I had seen the new parameter.