Skip to main content

Unofficial Python SDK for smscenter.gr REST API

Project description

PySMSCenter

Python SMS SDK for SMSCenter API integration.

Python Tests License Status

Unofficial Python SDK for smscenter.gr - not affiliated with or endorsed by SMSCenter.

PySMSCenter is a modern, typed Python SDK for integrating with the SMSCenter REST API.
It allows developers to send SMS messages, manage contacts and groups, perform HLR lookups, handle bulk SMS campaigns and implement two-factor authentication (2FA) workflows in Python applications.

pysmscenter provides a structured, well-tested interface for sending and managing SMS messages via smscenter

✨ Features

  • 📱 Send Single SMS
  • 📤 Send Bulk SMS
  • 📊 Check Account Balance
  • 📖 SMS History (Single & Grouped)
  • 📬 Delivery Status Tracking
  • 👤 Contact Management
  • 👥 Group Management
  • 🔐 Two-Factor Authentication (2FA)
  • 🔎 HLR Lookup
  • 👥 Sub-account Management
  • 🔁 Automatic Retry Support
  • ⚠️ Domain-Specific Exceptions
  • 🧪 Fully Tested
  • 🐍 Python 3.12+

Planned Features

  • Viber Management

📦 Installation

Once published to PyPI:

pip install pysmscenter

Until then:

git clone https://github.com/yourusername/PySMSCenter.git
cd PySMSCenter
pip install .

🔐 Authentication

You need an API key from:

https://smscenter.gr/api/docs/en

Using API Key

from pysmscenter import SMSClient

client = SMSClient("your_api_key")

Using Username & Password

from pysmscenter import SMSClient

client = SMSClient.from_credentials("username", "password")

🚀 Basic Usage

Context Manager (Recommended)

from pysmscenter import SMSClient

with SMSClient("your_api_key") as client:
    balance = client.balance.check()
    print(balance.get("balance"))

📱 SMS

Send Single SMS

client.sms.send(
    to="306912345678",
    text="Hello World",
    sender="MyApp"
)

Send Bulk SMS

numbers = ["306912345678", "306912345679"]

client.sms.bulk(
    to=numbers,
    text="Bulk message",
    sender="MyApp"
)

Cancel Scheduled SMS

client.sms.cancel("sms_id_here")

📊 Account & Status

Check Balance

client.balance.check()

Check Delivery Status

client.status.sms("sms_id_here")

Get Recent Status Reports

client.status.get()

📖 History

Single SMS History

client.history.single_list()

Grouped SMS History

client.history.group_list()

👤 Contacts

List Contacts

client.contact.list()

Add Contact

client.contact.add(
    mobile="306912345678",
    name="John",
    surname="Doe",
)

Update Contact

client.contact.update(
    contact_id="12345",
    name="Updated Name"
)

Delete Contact

client.contact.delete("12345")

👥 Groups

Create Group

client.group.add("Customers")

Add Contact to Group

client.group.add_contact(
    group_id="123",
    contact_id="456"
)

Remove Contact from Group

client.group.delete_contact(
    group_id="123",
    contact_id="456"
)

🔎 Mobile & HLR

Validate Mobile Number

client.mobile.check("306912345678")

HLR Lookup

client.hlr.lookup("306912345678")

🔐 Two Factor Authentication

Send 2FA Code

response = client.two_factor.send(
    to="306912345678",
    text="Your verification code is %%code%%"
)

Verify 2FA Code

client.two_factor.check(
    auth_id="auth_id_from_send",
    code="1234"
)

👥 Sub-Accounts

Create Sub-Account

client.user.add(
    email="subaccount@example.com",
    password="securepassword"
)

Top-up Sub-Account

client.user.topup(
    user_id="12345",
    sms="10",
    cost="5"
)

⚠️ Error Handling

All API errors raise domain-specific exceptions:

from pysmscenter.exceptions import SMSExceptionError

try:
    client.sms.send(...)
except SMSExceptionError as exc:
    print("Error code:", exc.code)
    print("Message:", exc.message)

Credential issues raise:

from pysmscenter.exceptions import CredentialError

🧪 Testing

Run the test suite:

pytest

📄 License

MIT License


🤝 Contributing

Contributions are welcome.
Please open an issue or submit a pull request.

Keywords

Python SMS SDK, SMS API client, Bulk SMS Python, SMS Gateway integration, SMSCenter API wrapper, SMS REST client, Two Factor Authentication API, HLR Lookup API, Python messaging library

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

pysmscenter-0.1.1.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

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

pysmscenter-0.1.1-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file pysmscenter-0.1.1.tar.gz.

File metadata

  • Download URL: pysmscenter-0.1.1.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for pysmscenter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8527ffef157ee736a64c583acdc6b124e705f6716dfa6da4f7c3da8ffc39a450
MD5 15b8413e1644b1e05cd5f559ca365456
BLAKE2b-256 4c39f00f29a16e95fd8420121ffa9e54ed147eaad02815caf68776799574209b

See more details on using hashes here.

File details

Details for the file pysmscenter-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pysmscenter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for pysmscenter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fafaab2a4c20bd3353724226348c158141cb58c52a11585a69a94fcfb56fedf5
MD5 da01d20679a13e570416d82ae93278a3
BLAKE2b-256 66b2ec7d9aebfafd414af3af593f2191ce5462baced29a406cac9b32053dd095

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