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.2.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.2-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: polylingo-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 23780d7d13d0e10c1461ce0920d9ebfd09cecc0ba0e67f484c32fe10643a08e2
MD5 cd21960744796bc19655485d336a831b
BLAKE2b-256 318ee6b5c1082b454a2d708394e9531502d9a2722edf7be3ad35efad0bee1071

See more details on using hashes here.

Provenance

The following attestation bundles were made for polylingo-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: polylingo-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4f429a73b4332bcab6428946b7e885adba0240c06234f39a250fc6f1f684d6dc
MD5 b3bb45caf7d67833708aebd8d213bd23
BLAKE2b-256 71c5896bc8f5d710d4edcf7489274f0245599349669846075a8d25f2145733e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for polylingo-0.1.2-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