Official Inksong SDK for Python.
Project description
inksong (Python SDK)
Official Inksong SDK for Python. Talks to the Inksong REST API at api.inksong.app.
Status: Source ships with each Inksong release. The first PyPI publish is a maintainer task — until then, install from the repo (
pip install <path/to/sdks/inksong-python>).
Install
# Once published to PyPI:
pip install inksong
# Today, from the repo:
pip install ./sdks/inksong-python
Requires Python 3.10+.
Usage
from inksong import InksongClient
with InksongClient(api_key="ink_...") as client:
out = client.humanize_text(
"Your AI-generated draft here",
tone="balanced",
humanness_level=50,
)
print(out["humanized_text"])
for doc in client.list_documents(limit=10):
print(doc["job_id"], doc["status"])
InksongClient is a context manager — __exit__ closes the underlying httpx.Client. You can also call client.close() explicitly.
Webhook signature verification
If you subscribe to webhooks at /dashboard/webhooks, every delivery is signed with HMAC-SHA256. Verify with:
from inksong import verify_signature
raw_body = request.body # bytes or str — both work
header = request.headers["Webhook-Signature"]
if not verify_signature(WEBHOOK_SECRET, raw_body, header):
return Response(status_code=400)
verify_signature rejects timestamps older than 5 minutes by default; pass max_age_seconds to change that.
Errors
The client raises InksongError on non-2xx responses. err.status_code is the HTTP status; err.body is the response text.
from inksong import InksongError
try:
client.humanize_text("...")
except InksongError as err:
if err.status_code == 429:
# back off
...
raise
Publish (maintainer)
# 1. Bump version in pyproject.toml
# 2. Build
python -m pip install build twine
python -m build
# 3. Verify
twine check dist/*
# 4. Upload
twine upload dist/*
License
MIT
Project details
Release history Release notifications | RSS feed
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 inksong-0.1.0.tar.gz.
File metadata
- Download URL: inksong-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16e5287ce535cb8dfef06b8169e6b19c01254d66894aa8db618fa2f3c4541634
|
|
| MD5 |
504406a750e1ff50ce56224726015103
|
|
| BLAKE2b-256 |
d1a9f7d7c0bd7cbad21377bd79fd5cdc9c92a6a088fbbd6e015c94ddfd8e3a07
|
File details
Details for the file inksong-0.1.0-py3-none-any.whl.
File metadata
- Download URL: inksong-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77242ecca9ec2bcb73339bb200040dba5edc83ab06f6738b1333e9ed576ea8e1
|
|
| MD5 |
0e8f006f1952ead9672adae0350b702f
|
|
| BLAKE2b-256 |
23fdbbd39b4f1b8d43783246cf2c71828d330af76852488015085b6c10080750
|