Python SDK
Thin, typed, retry-aware Python client — sync + async. MIT licensed.
Install
pip install rlbwhisk
Basic use
from rlbwhisk import Client
c = Client() # anonymous — 100 req/hour per IP
# or: Client(api_key="rlbwhisk_live_...")
# or: set RLBWHISK_API_KEY in your environment
# Manual mode — structured findings
result = c.check("Ths is a smple sentnce.", language="en")
for m in result.misspellings:
print(m.word, "->", m.suggestions[:3])
# Auto mode — get corrected text
fixed = c.fix("Ths is a smple sentnce.", language="en")
print(fixed.corrected_text)
# "This is a simple sentence."
Async
import asyncio
from rlbwhisk import AsyncClient
async def main():
c = AsyncClient()
r = await c.check("Ths is a test.", language="en")
print(r.misspellings)
asyncio.run(main())
Error handling
from rlbwhisk import (
Client,
WhiskError,
InvalidApiKey,
RateLimitExceeded,
InvalidLanguage,
InternalError,
)
try:
r = c.check("hi", language="en")
except InvalidApiKey:
print("Bad key — generate a fresh one at /whisk/keys/")
except RateLimitExceeded as e:
print(f"Retry after {e.retry_after}s (request {e.request_id})")
except InvalidLanguage:
print("Language not supported")
except InternalError as e:
print(f"Server error, quote request_id={e.request_id} in support")
except WhiskError as e:
print(f"[{e.code}] {e.message}")
The client auto-retries 429 Too Many Requests up to
max_retries=3 times, respecting the Retry-After header.
Options
c = Client(
api_key="rlbwhisk_live_...", # or RLBWHISK_API_KEY env
base_url="https://reglegbrief.com/whisk/api/v1", # default
timeout=30.0, # seconds
max_retries=3,
)
Methods
| Method | Returns | Endpoint |
|---|---|---|
check(text, language, ignore) | CheckResponse | POST /spellcheck |
fix(text, language, ignore) | FixResponse | POST /spellcheck/apply |
languages() | list[str] | GET /spellcheck/languages |
health() | dict | GET /health |
Data classes
@dataclass
class Misspelling:
word: str # lowercased
offset: int # character offset in source text
length: int
suggestions: list[str]
kind: str # "spell" | "repeat"
@dataclass
class CheckResponse:
language: str
total_words: int
misspellings: list[Misspelling]
@dataclass
class Change:
offset: int
before: str
after: str
kind: str
@dataclass
class FixResponse:
language: str
total_words: int
corrected_text: str
changes: list[Change]
unresolved: list[Misspelling] # findings with no suggestion
Source
MIT licensed. Repo: github.com/rlbwhisk/rlbwhisk-python