Skip to main content

TODO

Project description

deeplx-tr

pytestpythonCode style: blackLicense: MITPyPI version

deeplx in python

Install it

pip install deeplx_tr --pre

Use it

from command line

deeplx-tr hello world
# 哈罗世界

deeplx-tr hello world -t de
# Hallo Welt

deeplx-tr --help

or

python -m deeplx_tr hello world
python -m deeplx_tr hello world -d
python -m deeplx_tr --help

from python

from deeplx_tr import deeplx_tr

res = deeplx_tr("hello world")
print(res)
# 哈罗世界

res = deeplx_tr("hello world", to_lang="de")
print(res)
# Hallo Welt

N.B. deeplx-tr will likely spit out too many requestes if you call it too often before long. But it's sufficient for ordinary average daily translation. If you have a higher demand, try deeplx.org for which we provided two clients for your convenience.

clients to query a deeplx server (default deepx.org)

from deeplx_tr import deeplx_client, deeplx_client_async

res = deeplx_client("hello world")
print(res)
# '哈罗世界'

res = deeplx_client("hello world", target_lang="de")
print(res)
# 'Hallo Welt'

# if you host your own deeplx, for example, at `127.0.0.1:1188'
# res = deeplx_client("hello world", url="http://127.0.0.1:1188/translate")

An async client is also available, e.g.

import asyncio
from deeplx_tr import deeplx_client_async

async def main():
  res = await asyncio.gather(deeplx_client_async("hello world"), deeplx_client_async("test"))
  print(res)

asyncio.run(main())
# ['哈罗世界', '测试']

The default concurrency limit is 5 but can be altered by setting the environ variable CONCURRENCY_LIMIT, e.g.

set CONCURRENCY_LIMIT=8  # in Windows

# export CONCURRENCY_LIMIT=8 in Linux

Project details


Download files

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

Source Distribution

deeplx_tr-0.1.0a1.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

deeplx_tr-0.1.0a1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file deeplx_tr-0.1.0a1.tar.gz.

File metadata

  • Download URL: deeplx_tr-0.1.0a1.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for deeplx_tr-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 fd8454fa6abc2f91b1cc6dc2cf07cc3096b00b64935e86e6c2d107ec1588e367
MD5 add674bd989365ffbaa0fef606379ff3
BLAKE2b-256 4802942504dccee2d43d7bdaeca3e1fb02ef319f09aaf8c8980b00a456b74cf7

See more details on using hashes here.

File details

Details for the file deeplx_tr-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: deeplx_tr-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for deeplx_tr-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 7993c51be208a0351d9763c6c5d36ab9741f3faa27bf10fbe73060dba91e2b84
MD5 6986707ac8b01725911294c549ce7cf2
BLAKE2b-256 76e0f13d835f2a32a1b4175b10228dccbb9f9d60765f1bff6f34fbf5a664c5bf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page