inkrelay-sdk-python
Python client for the InkRelay cloud printing API.
Install
pip install inkrelay
The distribution is named inkrelay; the import package is inkrelay. Python 3.10 or newer.
Usage
from inkrelay import InkRelay
ir = InkRelay("ir_test_...") # or set INKRELAY_API_KEY
job = ir.print_jobs.create_and_wait(
{
"printerId": "0192f1a0-7c00-7000-8000-0000000000bb",
"title": "Invoice 1042",
"contentType": "pdf_uri",
"content": "https://example.com/invoice-1042.pdf",
},
timeout_s=60,
)
print(job["state"])
for printer in ir.printers.iterate(limit=100):
print(printer["id"], printer["name"])
Resources: computers, printers, print_jobs and webhooks have list, iterate and get; events has list and iterate. print_jobs.create always sends an Idempotency-Key (a random one unless you pass idempotency_key=), so retries never print twice. The client retries 429 responses, and 5xx or network errors for replay safe requests, up to max_retries (default 3). Errors raise InkRelayError with status, code and request_id.
ir.raw is the generated, fully typed client (inkrelay._generated) sharing the same retrying connection:
from inkrelay._generated.api.account import get_whoami
who = get_whoami.sync(client=ir.raw)
Caveats: only the sync functions on ir.raw itself retry. ir.raw.with_headers(...) (and with_cookies, with_timeout) adds the change to the shared client but returns a copy that builds its own httpx client without retries, and the asyncio variants use a separate async client that does not retry.
Webhooks
Verify each request with the endpoint's signing secret before trusting it. Pass the raw body, not parsed JSON:
from inkrelay import WebhookVerificationError, webhooks
try:
webhooks.verify(request.body, request.headers, "whsec_...")
except WebhookVerificationError:
return 400
Development
uv sync
uv run openapi-python-client generate --path openapi/openapi.json --config openapi-python-client.yml --meta none --output-path src/inkrelay/_generated --overwrite
uv run ruff check && uv run pytest
uv build
openapi/openapi.json is synced from inkrelay-api, and src/inkrelay/_generated is generated from it; do not edit either by hand. CI regenerates the client on every push and fails a pull request whose generated code is stale.
Releasing
Set version in pyproject.toml, merge, then push a matching tag (git tag v0.2.0 && git push origin v0.2.0). The release workflow checks that the tag matches the version, runs the tests, builds and publishes to PyPI through trusted publishing (GitHub environment pypi, PyPI project inkrelay).
License
MIT
Metadata
Release files for inkrelay 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| inkrelay-0.2.0.tar.gz | 99.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| inkrelay-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 218.9 kB
Release files / inkrelay-0.2.0.tar.gz
| Download URL | inkrelay-0.2.0.tar.gz |
|---|---|
| Size | 99.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d433999a6e284bd6383600249ec6d012751718f668f514ee3e82452021892862
|
|
BLAKE2b-256 checksum How to use checksums |
fc349f97b3110c2194c962ba6368bdc897278014eb5bfb9b6e5baab8cc2c708d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / inkrelay-0.2.0-py3-none-any.whl
| Download URL | inkrelay-0.2.0-py3-none-any.whl |
|---|---|
| Size | 119.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce077344f18ed4288b28740c209224788ec2e7c10a9ffea5ed1ef0206546689a
|
|
BLAKE2b-256 checksum How to use checksums |
51214a2b8575e6b77ea38585fa57044413b30066927059a095b1bd6062eb4b2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logSecurity for inkrelay 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for inkrelay-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.