Skip to main content

deepl-grpc

[tests]pythonCode style: blackLicense: MITPyPI version

deepl grpc, server and client, cross platform (Windows/MacOS/Linux)

Installation

  • Install grpcio-reflection
    • grpc-reflection cannot be installed using poetry add. Use pip install grpcio-reflection instead.
  • 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepl-grpc-0.1.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deepl_grpc-0.1.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file deepl-grpc-0.1.1.tar.gz.

File metadata

  • Download URL: deepl-grpc-0.1.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.9 Windows/10

File hashes

Hashes for deepl-grpc-0.1.1.tar.gz
Algorithm Hash digest
SHA256 777f3d987d7cfd1ef1b61240081647d126e46895fbeac88ea67c578ce9e577d9
MD5 e2bd3c001ab12b42a72ed70fe6211c12
BLAKE2b-256 422ce6528504edb1d1b9bd88761096fe5c31cf3006a4cf274eb603058bbc26cf

See more details on using hashes here.

File details

Details for the file deepl_grpc-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: deepl_grpc-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.9 Windows/10

File hashes

Hashes for deepl_grpc-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c8e0e802432c3453736c9c01de23cff14e839f589b6c243ed41b9a7406ecb5e
MD5 5a29bae9b3a59e54457820c84bd4fe92
BLAKE2b-256 89736718bd6e005c959635fdd44c9b2106e485d4eaf4225c6fd4f0001a9d1e87

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page