Async interfaces to the official Google Text to Speech or easygtts APIs
Project description
asyncgTTS
Asynchronous interfaces to the official Google Text to Speech or easygTTS APIs written with aiohttp.
Examples
asyncgTTS
import asyncio
import asyncgTTS
from subprocess import PIPE, run
async def main():
token = run(['gcloud', 'auth', 'application-default', 'print-access-token'], stdout=PIPE).stdout.decode().replace("\n", "")
async with await asyncgTTS.setup(premium=True, auth_token=token) as gtts:
hello_world_ogg = await gtts.get("Hello World", voice_lang=("en-US-Standard-B", "en-us"))
hello_world_mp3 = await gtts.get("Hello World", voice_lang=("en-US-Standard-A", "en-us"), ret_type="MP3")
with open("Hello_world.ogg", "wb") as f:
f.write(hello_world_ogg)
with open("Hello_world.mp3", "wb") as f:
f.write(hello_world_mp3)
asyncio.run(main())
easygTTS
import asyncgTTS
import asyncio
async def main():
async with await asyncgTTS.setup(premium=False) as gtts:
hello_world = await gtts.get(text="Hello World")
with open("Hello_world.mp3", "wb") as f:
f.write(hello_world)
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asyncgTTS-0.1.0.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for asyncgTTS-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53ae1bdb3dd1daa10abafdcf94495da3d9ed6d7f6d89f887a16d402084e9eaad |
|
MD5 | b320bdd5bd3d87818a865b44e0206c24 |
|
BLAKE2b-256 | f92f93aa9af560caa399c415bf7f61194f6d617ec3cb885ecd531f53f0dbecfd |