py-easygTTS
Asynchronous interface to an easy-gtts server written with aiohttp.
One class currently exists, easygTTS.gtts, which takes 2 optional args base_url (url to a easy-gtts server) and session (aiohttp.ClientSession)
Examples
One time use
import easygTTS
import asyncio
async def main():
async with easygTTS.gtts() as gtts:
hello_uk = await gtts.get(text="Hello World", lang="en-uk")
hello_usa = await gtts.get(text="Hello World", lang="en-us")
langs = await gtts.langs()
with open("Hello World (UK).mp3", "wb") as f:
f.write(hello_uk)
with open("Hello World (USA).mp3", "wb") as f:
f.write(hello_usa)
print(f"Returned langs = {langs}")
asyncio.run(main())
Using a global session
import easygTTS
import asyncio
import aiohttp
async def main():
session = aiohttp.ClientSession()
gtts = easygTTS.gtts(session=session)
hello = await gtts.get(text="Hello World")
with open("Hello.mp3", "wb") as f:
f.write(hello)
# later in your code
extra = await gtts.get(text="even more to TTS")
with open("Extra.mp3", "wb") as f:
f.write(extra)
# at the end
await session.close()
asyncio.run(main())
Metadata
Release files for easygTTS 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| easygTTS-1.0.tar.gz | 2.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| easygTTS-1.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 5.9 kB
Release files / easygTTS-1.0.tar.gz
| Download URL | easygTTS-1.0.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d47f66a1db1337980798ec2cd5c4d37e2f729bb3f670dd031975a915b890839
|
|
BLAKE2b-256 checksum How to use checksums |
ebd28ed99b2739787d0168505867bdb88823a0be29dae0d2fdc504c2158f9513
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.3
|
Release files / easygTTS-1.0-py2.py3-none-any.whl
| Download URL | easygTTS-1.0-py2.py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
21e552398e696ebfffd51833d2d47491446e5731fff2cd49b1bec51b10422803
|
|
BLAKE2b-256 checksum How to use checksums |
de72fbd9fc1f931df440fbc9c79398b22f627512fc1bef6b580cdf14dcf4e41c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.3
|