gTTS: requests.exceptions.HTTPError: 403 Client Error:

This used to work, but started failing all of a sudden.

Traceback (most recent call last):
  File "simple.py", line 29, in <module>
    tts.save(CLIP_NAME)
  File "/usr/lib/python2.7/site-packages/gtts/tts.py", line 94, in save
    self.write_to_fp(f)
  File "/usr/lib/python2.7/site-packages/gtts/tts.py", line 118, in write_to_fp
    r.raise_for_status()
  File "/usr/lib/python2.7/site-packages/requests/models.py", line 840, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://translate.google.com/translate_tts?q=hello&tl=en&client=t&textlen=5&idx=0&total=1&ie=UTF-8&tk=295461.176510

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (5 by maintainers)

Most upvoted comments

this fixed it: in tts.py line 105 change to ‘client’ : ‘tw-ob’,

and sexy google voice is back. although don’t know if the solution would work for everybody and / or permanent. looks google guys monitor IPs from which requests been sent (maybe considering client?) and block (for a client?)

On 13 May 2016 at 06:17, Alexander Ignatov ignalex@gmail.com wrote:

thanks arsanious for the links. if replacing

client=t

in the gTTS link with

client=tw-ob

it works (for me). btw strange thing = the voice is slightly different .

On 13 May 2016 at 02:48, arsanious notifications@github.com wrote:

so this works

http://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=hello&tl=En-gb

this (from the gTTS api) doesn’t

https://translate.google.com/translate_tts?q=hello&tl=en&client=t&textlen=5&idx=0&total=1&ie=UTF-8&tk=295461.176510

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/pndurette/gTTS/issues/32#issuecomment-218817052

Thanks @arsanious, @ignalex and everyone for reporting and especially finding the solution so quickly. Releasing a new version with the fix. Will report once it’s out.

thanks arsanious for the links. if replacing

client=t

in the gTTS link with

client=tw-ob

it works (for me). btw strange thing = the voice is slightly different .

On 13 May 2016 at 02:48, arsanious notifications@github.com wrote:

so this works

http://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=hello&tl=En-gb

this (from the gTTS api) doesn’t

https://translate.google.com/translate_tts?q=hello&tl=en&client=t&textlen=5&idx=0&total=1&ie=UTF-8&tk=295461.176510

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/pndurette/gTTS/issues/32#issuecomment-218817052

Same, what did Google change now