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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73dc7e8872f7920667dffbbc218ec273436d38cc626c5fab395b8a118e94d503
|
|
| MD5 |
c85897d3c9194eb48ca448072cd1d6e7
|
|
| BLAKE2b-256 |
c7f361c3cc7f15d31f1be095a25e2a5c1f255748016e0bc402ee888b4df1fc87
|
Provenance
The following attestation bundles were made for polylingo-0.1.3.tar.gz:
Publisher:
publish.yml on UsePolyLingo/polylingo-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polylingo-0.1.3.tar.gz -
Subject digest:
73dc7e8872f7920667dffbbc218ec273436d38cc626c5fab395b8a118e94d503 - Sigstore transparency entry: 1274954832
- Sigstore integration time:
-
Permalink:
UsePolyLingo/polylingo-python@7e837f81833ddb91367c06ec17636df833277c22 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/UsePolyLingo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7e837f81833ddb91367c06ec17636df833277c22 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3faf93e2854fac7abcc836acc79924bc57c48bf0916cc08a78160bc4b7a5314c
|
|
| MD5 |
eceb99523ce504eb335428055f132ab9
|
|
| BLAKE2b-256 |
4037d920c8408d2f9240237651489aa01c804de515388b83791ef1fc1791ec80
|
Provenance
The following attestation bundles were made for polylingo-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on UsePolyLingo/polylingo-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polylingo-0.1.3-py3-none-any.whl -
Subject digest:
3faf93e2854fac7abcc836acc79924bc57c48bf0916cc08a78160bc4b7a5314c - Sigstore transparency entry: 1274954906
- Sigstore integration time:
-
Permalink:
UsePolyLingo/polylingo-python@7e837f81833ddb91367c06ec17636df833277c22 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/UsePolyLingo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7e837f81833ddb91367c06ec17636df833277c22 -
Trigger Event:
push
-
Statement type: