deepl-tr-async-0.0.5
توضیحات
deepl translate for free, based on pyppeteer
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | deepl-tr-async-0.0.5 |
| نام | deepl-tr-async |
| نسخه کتابخانه | 0.0.5 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | ffreemt |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/ffreemt/deepl-tr-async |
| آدرس اینترنتی | https://pypi.org/project/deepl-tr-async/ |
| مجوز | MIT |
# deepl-tr-async [](https://github.com/ffreemt/deepl-tr-async/actions/workflows/build.yml)[](https://codecov.io/gh/ffreemt/deepl-tr-async)[](https://badge.fury.io/py/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_ppbrowser` is now an indepent package that `deepl-tr-async` depents 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`
<!--img src="img\sample2.png" height="170px" /-->

* Help 帮助:
`deepl-tr -?`
or
`deepl-tr --helpfull`
<!--img src="https://github.com/ffreemt/deepl-tr-async/blob/master/img/copyfrom-false.png" height="170px" /-->

### 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.,
```bash
PPBROWSER_HEADFUL=1
```
or from the cmomand line, e.g.,
```bash
set PPBROWSER_HEADFUL=1
# export PPBROWSER_HEADFUL=1 in linux or iOS
```
or in a python script
```python
import os
os.environ["PPBROWSER_HEADFUL"]="1" # note the quotes
```
PPBROWSER_DEBUG and PPBROWSER_PROXY can be set in a similar manner.
نیازمندی
| مقدار | نام |
|---|---|
| >=1.7.0,<2.0.0 | pyperclip |
| >=1.4.1,<2.0.0 | pyquery |
| >=1.5.0,<2.0.0 | logzero |
| >=7.3.1,<8.0.0 | environs |
| >=0.1.4,<0.2.0 | linetimer |
| >=0.9.0,<0.10.0 | absl-py |
| >=16.7.4,<17.0.0 | polyglot |
| >=0.18.0,<0.19.0 | fuzzywuzzy |
| >=3.6,<4.0 | pyinstaller |
| >=4.43.0,<5.0.0 | tqdm |
| >=3.7.9,<4.0.0 | flake8 |
| >=2.6,<3.0 | pyicu |
| >=0.41,<0.42 | pycld2 |
| >=2.8.1,<3.0.0 | pytest-cov |
| >=0.2.2,<0.3.0 | pyppeteer2 |
| >=0.1.1,<0.2.0 | get-ppbrowser |
| >=7.20.0,<8.0.0 | ipython |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7,<4.0 | Python |
نحوه نصب
نصب پکیج whl deepl-tr-async-0.0.5:
pip install deepl-tr-async-0.0.5.whl
نصب پکیج tar.gz deepl-tr-async-0.0.5:
pip install deepl-tr-async-0.0.5.tar.gz