Official Python SDK for the PolyLingo translation API
Project description
polylingo (Python)
Official Python SDK for the PolyLingo translation API.
Requirements: Python 3.9+
Install
pip install polylingo
Sync usage
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()
Context manager:
with polylingo.PolyLingo(api_key="...") as client:
print(client.languages())
Async usage
import polylingo
async with polylingo.AsyncPolyLingo(api_key="...") as client:
r = await client.translate(content="Hi", targets=["de"])
API
health()/await health()languages()translate(content=..., targets=..., format=..., source=..., model=...)batch(items=..., targets=..., source=..., model=...)usage()jobs.create(...)— returns 202 payloadjobs.get(job_id)jobs.translate(..., poll_interval=5.0, timeout=1200.0, on_progress=...)
Exceptions
PolyLingoError— base (status,error,args[0]message)AuthError— 401RateLimitError— 429 (retry_after)JobFailedError— failed job (job_id)
Docs
Python SDK reference (when deployed).
Repository
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.0.tar.gz.
File metadata
- Download URL: polylingo-0.1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5da091d7dbcfd358b515f0c25c70eaa1c5bc507f956a86f8cfe076178ae0a04
|
|
| MD5 |
cc2f2afd6c38683c60cc56d02e1aa0e0
|
|
| BLAKE2b-256 |
652dc7307a22085152fa9cb172a3bb74340953c956d543e5ab0508c10e04a04a
|
Provenance
The following attestation bundles were made for polylingo-0.1.0.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.0.tar.gz -
Subject digest:
d5da091d7dbcfd358b515f0c25c70eaa1c5bc507f956a86f8cfe076178ae0a04 - Sigstore transparency entry: 1222159400
- Sigstore integration time:
-
Permalink:
UsePolyLingo/polylingo-python@a4767f23a0d4bd0729a6839d382c4e2bf7483606 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/UsePolyLingo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a4767f23a0d4bd0729a6839d382c4e2bf7483606 -
Trigger Event:
push
-
Statement type:
File details
Details for the file polylingo-0.1.0-py3-none-any.whl.
File metadata
- Download URL: polylingo-0.1.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa741673f87762097dd08054e4b152f614260f1a8cfd76c6b3f4c5a1753efebd
|
|
| MD5 |
ea246ce168e815d0f28a758048a3d890
|
|
| BLAKE2b-256 |
be588a52ccc31a83c5d046c880ae4027da76edc2a19dd8edfb187beaa5f66794
|
Provenance
The following attestation bundles were made for polylingo-0.1.0-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.0-py3-none-any.whl -
Subject digest:
fa741673f87762097dd08054e4b152f614260f1a8cfd76c6b3f4c5a1753efebd - Sigstore transparency entry: 1222159478
- Sigstore integration time:
-
Permalink:
UsePolyLingo/polylingo-python@a4767f23a0d4bd0729a6839d382c4e2bf7483606 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/UsePolyLingo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a4767f23a0d4bd0729a6839d382c4e2bf7483606 -
Trigger Event:
push
-
Statement type: