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.polylingo.io/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.1.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.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for polylingo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c16141efe93c413c32f6f833ed390c51e8e2ac5267534f1877e77d3760e25c31
MD5 e4bc401fc58e7abae388fce69490dbee
BLAKE2b-256 c93f97f8e7eb3cbb3f4278e29443f670c7bfd2a1ff0ff1ba9c3365d3431db064

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for polylingo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e7f0724e18a5e6037d6003e0d19ab30d22e959063601d072366be87dd01655bc
MD5 e0806c68966a2aa8f4b8a2d58486f3de
BLAKE2b-256 11635f93dafdf9caf2869da6f296b1d5a19b86f7366633b2178a6b6ed089f839

See more details on using hashes here.

Provenance

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