async_google_trans_new
This is a library based on google_trans_new but it is async!
It's very easy to use and solve the problem that the old api which use tk value cannot be used.
This interface is for academic use only, please do not use it for commercial use.
Installation
Run this:
pip install async-google-trans-new
Basic Usage
Translate
import asyncio
import async_google_trans_new
async def coro():
g = async_google_trans_new.AsyncTranslator()
print(await g.translate("こんにちは、世界!","en"))
loop = asyncio.get_event_loop()
loop.run_until_complete(coro())
-> Hello world!
Advanced Usage
Translate
Multi Translate
import asyncio
from async_google_trans_new import AsyncTranslator
async def coro():
g = AsyncTranslator()
texts = ["こんにちは、世界!", "こんばんは、世界!", "おはよう、世界!"]
gathers = []
for text in texts:
gathers.append(g.translate(text, "en"))
print(await asyncio.gather(*gathers))
loop = asyncio.get_event_loop()
loop.run_until_complete(coro())
-> ['Hello World! ', 'Good evening, the world! ', 'Good morning, the world! ']
Prerequisites
- Python 3.8 (Please make GitHub issue if you can use this lib on different python version)
- aiohttp
- urllib3
License
Please see LICENSE.
Metadata
Release files for async-google-trans-new 1.4.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_google_trans_new-1.4.6-py3-none-any.whl | Python 3 | none | any | Details |
Release files / async_google_trans_new-1.4.6-py3-none-any.whl
| Download URL | async_google_trans_new-1.4.6-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50492183e9e9fb081376ad8e94a49dcaa3afa1ffa87a47710c0f04251b201e39
|
|
BLAKE2b-256 checksum How to use checksums |
7b01f59d3c01623dd4c2c975d3fda0b117bfd189e5ba694830ab93b44b70c7fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Security for async-google-trans-new 1.4.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.