deepl-grpc
deepl grpc, server and client, cross platform (Windows/MacOS/Linux)
Installation
- Install
grpcio-reflectiongrpc-reflectioncannot be installed usingpoetry add. Usepip install grpcio-reflectioninstead.
- Install the rest as usual
pip install deepl-grpc
or
poetry add deepl-grpc
or clone the repo (git clone https://github.com/ffreemt/deepl-grpc.git) and install from it. For example
git clone https://github.com/ffreemt/deepl-grpc.git
cd deepl-grpc
python3.8 -m venv .venv # require python3.7+
# for Linux/MacOS, you'd need to install venv and dev if you haven't done so
# sudo apt install python3.8-venv
# sudo apt install python3.8-dev
source .venv/bin/activate # or in Windows do: .venv\Scripts\activate
pip install grpcio-reflection
pip install -r requirements.txt
# or poetry install --no-dev
python -m deepl_grpc.deepl_client
Usage
python code
from deepl_grpc.deepl_client import DeeplClient
from linetimer import CodeTimer
client = DeeplClient()
text = "test this and that"
with CodeTimer(unit="s"):
result = client.get_url(message=text)
# Code block took: 1.99860 s
print(result.message)
# 试探 左右逢源 检验 审时度势
to_lang = "de"
with CodeTimer(unit="s"):
result = client.get_url(message=text, to_lang=to_lang,)
# Code block took: 2.02847 s
print(result.message)
# "Testen Sie dieses und jenes a Testen Sie dies und das a testen Sie dies und das Testen Sie dieses und jenes"
Interactive
- Start the grpc server
python -m deepl_grpc.deepl_server
The first run in Linux may take a while since chromium (~1G) needs to be downloaded. In Windows, Chrome will be used if it's available.
- Start the client
python -m deepl_grpc.deepl_client # to chinese
# python -m deepl_grpc.deepl_client de # to german
WebUI
Download grpcui and run, for example in Windows
grpcui.exe -plaintext 127.0.0.1:50051
to explore the server in the same manner as Postman for REST.
pyppeteer issues in Linux
You may encounter the following error in Linux:
chromium/linux-588429/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory
You may wish to try this fix in Ubuntu https://medium.com/@cloverinks/how-to-fix-puppetteer-error-ibx11-xcb-so-1-on-ubuntu-152c336368
sudo apt-get install gconf-service libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxss1 libxtst6 libappindicator1 libnss3 libasound2 libatk1.0-0 libc6 ca-certificates fonts-liberation lsb-release xdg-utils wget
More coming soon
Metadata
Release files for deepl-grpc 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| deepl-grpc-0.1.1.tar.gz | 7.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| deepl_grpc-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.3 kB
Release files / deepl-grpc-0.1.1.tar.gz
| Download URL | deepl-grpc-0.1.1.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
777f3d987d7cfd1ef1b61240081647d126e46895fbeac88ea67c578ce9e577d9
|
|
BLAKE2b-256 checksum How to use checksums |
422ce6528504edb1d1b9bd88761096fe5c31cf3006a4cf274eb603058bbc26cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.7.9 Windows/10
|
Release files / deepl_grpc-0.1.1-py3-none-any.whl
| Download URL | deepl_grpc-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c8e0e802432c3453736c9c01de23cff14e839f589b6c243ed41b9a7406ecb5e
|
|
BLAKE2b-256 checksum How to use checksums |
89736718bd6e005c959635fdd44c9b2106e485d4eaf4225c6fd4f0001a9d1e87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.7.9 Windows/10
|