onesms-sdk¶
A Python client for the 1sms.az SMS API. It gives you a small, typed interface for sending messages, checking delivery, and verifying webhooks, and it behaves the same whether your code is synchronous or async.
from onesms import Client
with Client("1sk_your_api_key", sender_name="YourSender") as client:
result = client.send_otp("994501234567", "Your code is 123456")
print(result.message_id, result.cost, result.balance)
What you get¶
- One class for sync code (
Client) and one for async (AsyncClient). Same methods, same results. - Sending for OTP, notifications, and advertising, plus balance and delivery lookups.
- Responses come back as typed dataclasses, so your editor knows every field.
- Failed requests are retried for you, with backoff that respects the server's
Retry-After. - Idempotency keys, so a retried send never goes out twice.
- Errors you can catch by type instead of reading status codes by hand.
- Webhook signature checking built in.
The only runtime dependency is httpx.
Where to go next¶
- New here? Start with Installation and the Quickstart.
- Sending your first message? See Sending messages.
- Handling failures? Read Errors and Retries and idempotency.
- Receiving delivery callbacks? See Webhooks.
The underlying HTTP API is documented at 1sms.az/api-docs.