Skip to main content

Python client for Eskiz.uz SMS API

Project description

Eskiz.uz SMS Integration SDK

Support on Telegram

PyPI - Downloads PyPI - Version

Welcome to eskiz-pkg, the open source Python SDK for Eskiz.uz SMS API.

You can use it for both synchronous and asynchronous applications with automatic token refresh.

Features

✅ Sync & Async Support ✅ Automatic Token Refresh
✅ Batch SMS Sending ✅ International SMS
✅ Message Templates ✅ Detailed Reporting

Installation

Basic Installation

$ pip install eskiz-pkg

With Async Support

$ pip install eskiz-pkg[async]

Credentials

URL: https://notify.eskiz.uz/api/
Email: test@eskiz.uz
Password: j6DWtQjjpLDNjWEk74Sx

Docs

Send SMS

Example for send SMS:

Request

from eskiz.client.sync import ClientSync

eskiz_client = ClientSync(
    email="test@eskiz.uz",
    password="j6DWtQjjpLDNjWEk74Sx",
)

text = "Hello from Python"

resp = eskiz_client.send_sms(
    phone_number=998888351717,
    message=text
)

print(resp)

Response

id='e837dec2-2f5a-44a9-a1d1-6fcc13e94d86' message='Waiting for SMS provider' status='waiting'

Refresh Token

Example for refresh token:

Request

from eskiz.client.sync import ClientSync

eskiz_client = ClientSync(
    email="test@eskiz.uz",
    password="j6DWtQjjpLDNjWEk74Sx",
)

resp = eskiz_client.refresh_token()
print(resp)

Response

eyJleHAiOjE3MjA4NTQ5NTUsImlhdCI6MTcxODI2Mjk1NSwicm9sZSI6InVzZXIiLCJzaWduIjoiNjU5OWQ1MWU4ZjU0NTFmMjc3OTQ1MTA3N2NmMzdmMTMxM2QzYjkzMDk1Y

Check Balance

Example for checking the SMS balance:

Request

from eskiz.client.sync import ClientSync

eskiz_client = ClientSync(
    email="test@eskiz.uz",
    password="j6DWtQjjpLDNjWEk74Sx",
)

balance = eskiz_client.get_balance()
print(f"Remaining SMS credits: {balance}")

Response

Remaining SMS credits: 0

Send Batch SMS

Example for sending multiple SMS messages in a single request:

Request

from eskiz.client.sync import ClientSync

eskiz_client = ClientSync(
    email="test@eskiz.uz",
    password="j6DWtQjjpLDNjWEk74Sx",
)

messages = [
    {"user_sms_id": "msg1", "to": 998888351717, "text": "Hello from Python 1"},
    {"user_sms_id": "msg2", "to": 998888351718, "text": "Hello from Python 2"}
]

resp = eskiz_client.send_batch_sms(
    messages=messages,
    dispatch_id=123  # Optional
)

print(resp)

Response

id='9309c090-8bc5-4fae-9d82-6b84af55affe' message='Waiting for SMS provider' status=['waiting', 'waiting']

Send Global SMS

Example for sending SMS to international numbers:

Request

from eskiz.client.sync import ClientSync

eskiz_client = ClientSync(
    email="test@eskiz.uz",
    password="j6DWtQjjpLDNjWEk74Sx",
)

resp = eskiz_client.send_global_sms(
    mobile_phone="12025550123",  # US number
    message="Hello from Python",
    country_code="US"
)

print(resp)

Response

success=True

Get User Messages

Example for retrieving user messages within a date range:

Request

from eskiz.client.sync import ClientSync

eskiz_client = ClientSync(
    email="test@eskiz.uz",
    password="j6DWtQjjpLDNjWEk74Sx",
)

resp = eskiz_client.get_user_messages(
    start_date="2023-11-01 00:00",
    end_date="2023-11-02 23:59",
    page_size="20"
)

print(f"Total messages: {resp.data.total}")
for msg in resp.data.result:
    print(f"Message to {msg.to}: {msg.message} - Status: {msg.status}")

Get User Messages by Dispatch

Example for retrieving user messages by dispatch ID:

Request

from eskiz.client.sync import ClientSync

eskiz_client = ClientSync(
    email="test@eskiz.uz",
    password="j6DWtQjjpLDNjWEk74Sx",
)

resp = eskiz_client.get_user_messages_by_dispatch(
    dispatch_id="123"
)

print(f"Total messages: {resp.data.total}")
for msg in resp.data.result:
    print(f"Message to {msg.to}: {msg.message} - Status: {msg.status}")

Get Dispatch Status

Example for retrieving status of a dispatch:

Request

from eskiz.client.sync import ClientSync

eskiz_client = ClientSync(
    email="test@eskiz.uz",
    password="j6DWtQjjpLDNjWEk74Sx",
)

resp = eskiz_client.get_dispatch_status(
    user_id="1",
    dispatch_id="123"
)

for status_item in resp.data:
    print(f"Status: {status_item.status}, Total: {status_item.total}")

Get Message Status

Example for retrieving status of a specific message by ID:

Request

from eskiz.client.sync import ClientSync

eskiz_client = ClientSync(
    email="test@eskiz.uz",
    password="j6DWtQjjpLDNjWEk74Sx",
)

resp = eskiz_client.get_message_status(
    message_id="c779e2c3-9140-4b0f-862d-ee5639c3f5e0"
)

print(f"Message to {resp.data.to}: {resp.data.message} - Status: {resp.data.status}")

Get Templates

Example for retrieving user templates:

Request

from eskiz.client.sync import ClientSync

eskiz_client = ClientSync(
    email="test@eskiz.uz",
    password="j6DWtQjjpLDNjWEk74Sx",
)

resp = eskiz_client.get_templates()

for template in resp.result:
    print(f"Template ID: {template.id}, Template: {template.template}")

Export Messages

Example for exporting messages for a specific month:

Request

from eskiz.client.sync import ClientSync

eskiz_client = ClientSync(
    email="test@eskiz.uz",
    password="j6DWtQjjpLDNjWEk74Sx",
)

csv_data = eskiz_client.export_messages(
    year="2025",
    month="1"
)

# Save to file
with open("messages_export.csv", "w") as f:
    f.write(csv_data)

print("Export saved to messages_export.csv")

Async Client

The library also provides an async client for use with modern Python applications using asyncio.

Basic Usage

import asyncio
from eskiz.client import AsyncClient

async def main():
    async with AsyncClient(
        email="test@eskiz.uz",
        password="j6DWtQjjpLDNjWEk74Sx",
    ) as client:
        # Send SMS
        response = await client.send_sms(
            phone_number=998888351717,
            message="Hello from Python"
        )
        print(response)

        # Check balance
        balance = await client.get_balance()
        print(f"Balance: {balance}")

asyncio.run(main())

Sending Batch SMS with Async Client

import asyncio
from eskiz.client import AsyncClient

async def main():
    async with AsyncClient(
        email="test@eskiz.uz",
        password="j6DWtQjjpLDNjWEk74Sx",
    ) as client:
        messages = [
            {"user_sms_id": "msg1", "to": 998888351717, "text": "Hello from Python 1"},
            {"user_sms_id": "msg2", "to": 998888351718, "text": "Hello from Python 2"}
        ]

        response = await client.send_batch_sms(messages=messages)
        print(response)

asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eskiz_pkg-2.0.1.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eskiz_pkg-2.0.1-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file eskiz_pkg-2.0.1.tar.gz.

File metadata

  • Download URL: eskiz_pkg-2.0.1.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for eskiz_pkg-2.0.1.tar.gz
Algorithm Hash digest
SHA256 cbf306d82d7b99c85d919b2625a7d5ae79192c5d51f5ed5b48155ecc38108711
MD5 d6d4cbf47e8c4674b034bc06660bf154
BLAKE2b-256 850ae02e41f8f5cad81a226cab97b165806e0e8ed8272bab45e25015d720fb13

See more details on using hashes here.

File details

Details for the file eskiz_pkg-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: eskiz_pkg-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for eskiz_pkg-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6fda0a4e7405a1fbdbb87de43e4f2557e0a8e025580edcc45270bdd9ae448d9a
MD5 7e3441747124877a9b53cd8664a24341
BLAKE2b-256 37a38c40d61a59a3071cad1a7d7d4100ff41087a0cd2077ec761e9392987d903

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page