GnomedDev / asyncgTTS

Async interfaces to the official Google Text to Speech or easygtts APIs
MIT License
4 stars 2 forks source link

404 Not Found #1

Open Zapzatron opened 1 year ago

Zapzatron commented 1 year ago
import asyncio
import aiohttp
import asyncgTTS

async def main():
    async with aiohttp.ClientSession() as session:
        gtts = await asyncgTTS.setup(premium=False, session=session)
        text = "Hello World"
        hello_world = await gtts.get(text=text)
        with open("test.mp3", "wb") as f:
            f.write(hello_world)

asyncio.run(main())
easygttsException                         Traceback (most recent call last)
[<ipython-input-21-b0dc61b23000>](https://localhost:8080/#) in <cell line: 16>()
     14             f.write(hello_world)
     15 
---> 16 asyncio.run(main())
     17 
     18 import IPython.display as ipd

5 frames
[/usr/local/lib/python3.10/dist-packages/asyncgTTS/easygTTS.py](https://localhost:8080/#) in get(self, **kwargs)
     34                 raise RatelimitException(content, headers)
     35 
---> 36             raise easygttsException(f"{resp.status} {resp.reason}: {await resp.read()}")
     37 
     38     @require_session

easygttsException: 404 Not Found: b'<!DOCTYPE html>\n<html>\n  <head>\n    <meta name="viewport" content="width=device-width, initial-scale=1">\n    <meta charset="utf-8">\n    <title>Heroku | Application Error</title>\n    <style media="screen">\n      html,body,iframe {\n        margin: 0;\n        padding: 0;\n      }\n      html,body {\n        height: 100%;\n        overflow: hidden;\n      }\n      iframe {\n        width: 100%;\n        height: 100%;\n        border: 0;\n      }\n    </style>\n  </head>\n  <body>\n    <iframe src="//[www.herokucdn.com/error-pages/no-such-app.html](http://www.herokucdn.com/error-pages/no-such-app.html)"></iframe>\n  </body>\n</html>\n'
GnomedDev commented 1 year ago

Hey, this library is a janky mess which required a service I was hosting on heroku. Since that died a while ago, I'm going to archive the library.

For people who want to use something like this library, either asyncio.to_thread the gtts library or do your own requests.