Skip to main content

A modern Python wrapper for the Dinstar UC Gateway HTTP API (latest version).

Project description

dinstar-uc-api

A modern Python wrapper for the latest version of the Dinstar UC HTTP API.

This library provides typed access to Dinstar gateway endpoints for SMS, USSD, device status, port management, STK menus, and more. Built for developers who want clean, extendable, and well-documented access to gateway functionality.


📦 Features

  • ✅ Send and receive SMS messages
  • ✅ Manage USSD sessions and replies
  • ✅ Monitor device and port status
  • ✅ Query and interact with SIM Toolkit (STK) menus
  • ✅ Typed dataclass models for responses
  • ✅ Unified request logic via send_api_request

🚀 Installation

pip install dinstar-uc-api

⚙️ Configuration

Create a .env file in your root directory with the following:

DINSTAR_USER=admin
DINSTAR_PASS=admin
DINSTAR_URL=https://your_gateway_ip
DINSTAR_VERIFY_SSL=false

This is accessed in code using decouple.config.

🧪 Quick Start with DinstarClient

from dinstar.client import DinstarClient
from decouple import config

client = DinstarClient(
    username=config("DINSTAR_USER"),
    password=config("DINSTAR_PASS"),
    gateway_url=config("DINSTAR_URL"),
    verify_ssl=config("DINSTAR_VERIFY_SSL", cast=bool, default=True)
)

# Fetch unread SMS messages
sms = client.sms.receive_sms(flag="unread")
for msg in sms.data:
    print(f"[{msg.port}] {msg.number}{msg.text}")

# Send USSD
ussd_response = client.ussd.send_ussd(text="*100#", ports=[0])
print(ussd_response)

# Query device performance
device_status = client.device.get_device_status()
print(device_status)

🧰 Example Scripts

Explore the examples/ folder:

  • sms_fetch.py — Receive all SMS messages
  • sms_send.py — Send a batch of SMS messages and track delivery
  • send_ussd.py — Send and query USSD messages
  • get_status.py — Query device performance (CPU, memory, flash)
  • get_stk.py — Query STK menu and cancel
  • set_port.py — Power ports on or off
  • get_cdr.py — Query CDR logs

📚 Library Structure

Module Description
dinstar.sms SMS send, receive, queue, status
dinstar.ussd USSD messaging and replies
dinstar.device Device performance + SIM status
dinstar.port Port info and control
dinstar.cdr Call detail records
dinstar.stk STK menus and input
dinstar.client Unified wrapper across all modules
dinstar.models Typed dataclasses for all responses
dinstar.webhook_models Pydantic models for push events

🪪 License

This project is licensed under the terms of the MIT license. For more details see LICENSE

🤝 Contributing

Pull requests welcome. Please write clean code, include examples, and test API compatibility before submitting.

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

dinstar_uc_api-0.1.0.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

dinstar_uc_api-0.1.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file dinstar_uc_api-0.1.0.tar.gz.

File metadata

  • Download URL: dinstar_uc_api-0.1.0.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dinstar_uc_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 80bedb8c501c0c0b3e4624563035ddf9db4ed6e75f387cff45b680986190bf75
MD5 e61f4d97e4d4b1b5c01da0fe3b66acc7
BLAKE2b-256 e1c2f148faf405b717d441356718a1b99cc8eaa7e226446c3ee8fc2447b2ffa6

See more details on using hashes here.

Provenance

The following attestation bundles were made for dinstar_uc_api-0.1.0.tar.gz:

Publisher: python-publish.yml on moucester/Dinstar-UC-API

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dinstar_uc_api-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dinstar_uc_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dinstar_uc_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1eccd0329a99d55c551b9b6ec23b9c77e8c64687bf678625a64d378d281f61f3
MD5 9af57e90888fab766abaf9ee7fd270e3
BLAKE2b-256 2853b9df555101522fb73292066bc63c1430bce9cdbfc6bd69539fda8daefd9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for dinstar_uc_api-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on moucester/Dinstar-UC-API

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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