deepl-tr-async 


deepl translate for free with async and proxy support, based on pyppeteer
Changes in v0.0.5
- Python 3.6 is no longer supported.
get_ppbrowseris now an indepent package thatdeepl-tr-asyncdepents on.
Pre-installation of libicu
For Linux/OSX
E.g.
- Ubuntu:
sudo apt install libicu-dev - Centos:
yum install libicu - OSX:
brew install icu4c
For Windows
Download and install the pyicu and pycld2 whl packages for your OS version from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyicu and https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycld2
Installation
pip install deepl-tr-async
Validate installation
python -c "import deepl_tr_async; print(deepl_tr_async.__version__)"
# 0.0.2 or other version info
Usage
from the command line 命令行调用
- translate the system clipboad (not tested in Linux) 翻译系统剪贴板
deepl-tr - translate text supplied from the command line 翻译终端提供的句子
deepl-tr --copyfrom=false this is a test
- Help 帮助:
deepl-tr -?
or
deepl-tr --helpfull
Programmatic use 程序调用
import asyncio
from deepl_tr_async import deepl_tr_async
from deepl_tr_async.google_tr_async import google_tr_async
loop = asyncio.get_event_loop()
sent = 'Global coronavirus pandemic kills more than 30,000'
res = loop.run_until_complete(deepl_tr_async(sent, to_lang='zh'))
print(res)
# Alternatives:
# 全球冠状病毒大流行导致超过3万人死亡
# 全球冠状病毒大流行导致3万多人死亡
# 全球冠状病毒大流行导致超过30,000人死亡
# 全球冠状病毒大流行导致3万多人丧生
res = loop.run_until_complete(google_tr_async(sent, to_lang='zh'))
print(res)
# 全球冠状病毒大流行杀死超过30,000人
tasks = [deepl_tr_async(sent, to_lang='zh'), google_tr_async(sent, to_lang='zh')]
_ = asyncio.gather(*tasks)
res = loop.run_until_complete(_)
print(res)
['Alternatives:\n全球冠状病毒大流行导致超过3万人死亡\n全球冠状病毒大流行导致3万多人死亡\n全球冠状病毒大流行导致超过30,000人死亡\n全球冠状病毒大流行导致3万多人丧生', '全球冠状病毒大流行杀死超过30,000人']
Environment variables: PPBROWSER_HEADFUL, PPBROWSER_DEBUG, PPBROWSER_PROXY
This version of deep-tr-async makes use of the package get-ppbrowser. get-ppbrowser is a headless browser based on pyppeteer2.
To turn off headless mode, i.e., to show the browser in action, set PPBROWSER_HEADFUL to 1 (or true or True) in the .env file, e.g.,
PPBROWSER_HEADFUL=1
or from the cmomand line, e.g.,
set PPBROWSER_HEADFUL=1
# export PPBROWSER_HEADFUL=1 in linux or iOS
or in a python script
import os
os.environ["PPBROWSER_HEADFUL"]="1" # note the quotes
PPBROWSER_DEBUG and PPBROWSER_PROXY can be set in a similar manner.
Metadata
Release files for deepl-tr-async 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| deepl-tr-async-0.0.5.tar.gz | 14.5 kB | Without provenance | Details for deepl-tr-async-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deepl_tr_async-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for deepl_tr_async-0.0.5-py3-none-any.whl |
Total release size: 33.7 kB
Release files / deepl-tr-async-0.0.5.tar.gz
| Download URL | deepl-tr-async-0.0.5.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67114cf2fe318433229e969c69da5de029330165fa59b3c7df646cb626d7b60f
|
|
BLAKE2b-256 checksum How to use checksums |
886b55deba4b279a4f607cd1f9858a3f6c7f77746b74ef1d991196ed328a3092
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.7.2 Windows/10
|
Release files / deepl_tr_async-0.0.5-py3-none-any.whl
| Download URL | deepl_tr_async-0.0.5-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b7db8da6dfc1cf9cc4613a0f6f119f83b0769072eb2816dfe7833fa5a268b73
|
|
BLAKE2b-256 checksum How to use checksums |
0d755066206283572ea0f272e01ab98c754a8bcf214ffb840bc7a7d1166ba69b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.7.2 Windows/10
|
Security for deepl-tr-async 0.0.5
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.