Production-grade Python SDK for the Tiny ERP API v2. Fully typed, async-ready, and safe for FastAPI services and message queue workers.
- Single entry point — all interaction through
TinyClientorAsyncTinyClient - Typed contracts — every method accepts and returns Pydantic v2 models
- Automatic rate limiting — token bucket per client instance, plan-aware (30 / 60 / 120 RPM)
- Retry with exponential backoff — automatic on 429 / 5xx responses
- Sync + Async —
TinyClientfor workers,AsyncTinyClientfor FastAPI - No global state — multiple tokens and plans can coexist in the same process
pip install tiny-pyRequires Python 3.11+.
from tiny_py import TinyClient
client = TinyClient(token="your_token", plan="advanced")
# Stream all active products
for product in client.products.iter_search():
print(product.sku, product.name, product.price)
# Fetch a single order
order = client.orders.get("970977594")
print(order.number, order.total)from tiny_py import AsyncTinyClient
async with AsyncTinyClient(token="your_token", plan="advanced") as client:
products = await client.products.search()
order = await client.orders.get("970977594")| Resource | Methods |
|---|---|
| Products | search, iter_search, get, get_stock, update_stock, update_price |
| Orders | search, iter_search, get |
See the roadmap for planned resources.
from tiny_py.exceptions import TinyAPIError, TinyRateLimitError, TinyServerError, TinyTimeoutError
try:
order = client.orders.get(order_id)
except TinyAPIError:
# Business error — do not retry (send to DLQ)
...
except (TinyRateLimitError, TinyServerError, TinyTimeoutError):
# Transient error — re-enqueue with backoff
...MIT