google trnaslate async for free
Project description
google-tr-async-free
Google translate for free -- local cache and throttling (averag 1.5 calls/s, first 1000 calls exempted).. Let's hope it lasts.
Installation
pip install google-tr-async-free
or
- Install (pip or whatever) necessary requirements, e.g.
pip install requests_cache js2py
orpip install -r requirements.txt
- Drop the file google_tr.py in any folder in your PYTHONPATH (check with import sys; print(sys.path)
- or clone the repo (e.g.,
git clone https://github.com/ffreemt/google-tr-async-free.git
or download https://github.com/ffreemt/google-tr-async-free/archive/master.zip and unzip) and change to the google-tr-free folder and do apython setup.py develop
Usage
import asyncio
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
arun = lambda x: loop.run_until_complete(x)
from google_tr_async import google_tr_async
_ = [google_tr_async('hello world'),
google_tr_async('hello world', to_lang='de'),
google_tr_async('hello world', to_lang='fr'),
google_tr_async('hello world', to_lang='ja')]
res = arun(asyncio.gather(*_))
print(res[0]) # ->'你好,世界'
print(res[1]) # ->'Hallo Welt'
print(res[2]) # ->'Bonjour le monde'
print(res[3]) # ->'こんにちは世界'
Acknowledgments
- Thanks to everyone whose code was used
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
Built Distribution
Close
Hashes for google-tr-async-free-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed05af8e25e95f4219d41a89f93dc945c2dc33340fbc80afbca1134d2f9aca20 |
|
MD5 | 08a570dfe39f322b126516d7a0422b10 |
|
BLAKE2b-256 | aa43d5429eff7244873990e0b1409bc94d74e615cdb3da7299cd1dbe6e4c18e3 |
Close
Hashes for google_tr_async_free-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c5c533bac685100a16b411d0e78806941a613cf323e14e9756ae1f10961c996 |
|
MD5 | e691eeff5397fe853a83529794c506c4 |
|
BLAKE2b-256 | 138e492e188ffcd7e15cf3904668d61de91a3b3fc2ebc7f16352558c7dc34809 |