Skip to main content

Official Python SDK for the PolyLingo translation API

Project description

polylingo (Python)

Python client for the PolyLingo translation API.

Requires Python 3.9+.

Install

pip install polylingo

Sync client

import os
import polylingo

client = polylingo.PolyLingo(
    api_key=os.environ["POLYLINGO_API_KEY"],
    # base_url="https://api.usepolylingo.com/v1",
    # timeout=120.0,
)

result = client.translate(content="# Hello", targets=["es", "fr"], format="markdown")
print(result["translations"]["es"])
client.close()
with polylingo.PolyLingo(api_key="...") as client:
    print(client.languages())

Async client

import polylingo

async with polylingo.AsyncPolyLingo(api_key="...") as client:
    r = await client.translate(content="Hi", targets=["de"])

API

Same names on PolyLingo and AsyncPolyLingo (async methods are awaited).

Area Notes
health() GET /health
languages() GET /languages
translate(...) POST /translate
batch(...) POST /translate/batch
usage() GET /usage
jobs.create(...) POST /jobs (202 body)
jobs.get(job_id) GET /jobs/:id
jobs.translate(...) Submit and poll (poll_interval, timeout, on_progress)

Exceptions

PolyLingoError (status, error, message string). AuthError (401), RateLimitError (429, retry_after), JobFailedError (job_id).

Documentation

Python SDK on usepolylingo.com

Repository

github.com/UsePolyLingo/polylingo-python

License

MIT

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

polylingo-0.1.3.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

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

polylingo-0.1.3-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file polylingo-0.1.3.tar.gz.

File metadata

  • Download URL: polylingo-0.1.3.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for polylingo-0.1.3.tar.gz
Algorithm Hash digest
SHA256 73dc7e8872f7920667dffbbc218ec273436d38cc626c5fab395b8a118e94d503
MD5 c85897d3c9194eb48ca448072cd1d6e7
BLAKE2b-256 c7f361c3cc7f15d31f1be095a25e2a5c1f255748016e0bc402ee888b4df1fc87

See more details on using hashes here.

Provenance

The following attestation bundles were made for polylingo-0.1.3.tar.gz:

Publisher: publish.yml on UsePolyLingo/polylingo-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polylingo-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: polylingo-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for polylingo-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3faf93e2854fac7abcc836acc79924bc57c48bf0916cc08a78160bc4b7a5314c
MD5 eceb99523ce504eb335428055f132ab9
BLAKE2b-256 4037d920c8408d2f9240237651489aa01c804de515388b83791ef1fc1791ec80

See more details on using hashes here.

Provenance

The following attestation bundles were made for polylingo-0.1.3-py3-none-any.whl:

Publisher: publish.yml on UsePolyLingo/polylingo-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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