baidu translate for free
Project description
baidu-tr-free
Baidu translate for free -- local cache plus throttling. Let's hope it lasts.
Installation
pip install baidu-tr-free -U- Install (pip or whatever) necessary requirements, e.g.
pip install js2py requests_cache jsonpath_rworpip install -r requirements.txt - Drop the file bdtr.py in any folder in your PYTHONPATH (check with import sys; print(sys.path)
- Several valid TOKEN/BAIDUID are included.
- or clone the repo (e.g.,
git clone https://github.com/ffreemt/baidu-tr-free.gitor download https://github.com/ffreemt/baidu-tr-free/archive/master.zip and unzip) and change to the baidu-tr-free folder and do apython setup.py develop
Usage
from bdtr import bdtr
print(bdtr('hello world')) # -> '你好,世界'
print(bdtr('hello world', to_lang='de')) # ->'Hallo Welt'
print(bdtr('hello world', to_lang='jp')) # ->'ハローワールド'
Validation and Pressure Tests
- pip install pytest
- pytest
- Average delay for throttling set to 0.6 s, ajdust as needed
Acknowledgments
- Thanks to everyone whose code was used
- JS_SIGN (javascript code for signing) can be found on the net. It's also not too difficult to obtain some similar code from Chrome's devtools.
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
baidu-tr-free-0.0.3.tar.gz
(7.3 kB
view details)
File details
Details for the file baidu-tr-free-0.0.3.tar.gz.
File metadata
- Download URL: baidu-tr-free-0.0.3.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.0 requests-toolbelt/0.8.0 tqdm/4.32.1 CPython/3.6.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8bb80670c1b89bb18483ce89a3eadad19a89e7ff3193d7389a46c80f0731229
|
|
| MD5 |
4bab67df00db17df2b9c03db434ec138
|
|
| BLAKE2b-256 |
027528dc7e9c518b1c9e8b84f6bc0bcb9c2abac3795a55a9899a6eb6fc0af5ab
|