FitSMS Python SDK (v4)
The official Python SDK for the FitSMS.lk gateway, maintained by Global Cloud Media. This package provides a seamless way to integrate SMS capabilities into Python applications, automation scripts, and AI agents using the FitSMS v4 API.
🚀 Features
- Auto-Formatting: Converts Sri Lankan numbers into
947XXXXXXXXformat. - v4 Support: Fully compatible with FitSMS v4 REST API.
- Requests Powered: Uses the industry-standard
requestslibrary. - DevOps Ready: Lightweight and ideal for VPS alerts, cron jobs, and monitoring systems.
📦 Installation
pip install fitsms
⚡ Quick Start
1. Initialize the Client
from fitsms import FitSMS
api_token = 'YOUR_V4_API_TOKEN'
sender_id = 'YOUR_SENDER_ID'
sms = FitSMS(api_token, sender_id)
2. Send an SMS
try:
response = sms.send('0761234567', 'Hello from Global Cloud Media!')
if response.get('status') == 'success':
print(f"Message Sent! RUID: {response['data']['ruid']}")
else:
print(f"Failed: {response.get('message')}")
except Exception as e:
print(f"Error: {str(e)}")
3. Check Account Balance
balance = sms.get_balance()
print(f"Remaining Units: {balance['data']['sms_unit']}")
📖 API Reference
| Method | Parameters | Description |
|---|---|---|
| send() | recipient(s), message | Send SMS (Single/Bulk) |
| get_balance() | none | Get SMS unit balance |
| get_status() | ruid, recipient | Check delivery status |
| get_profile() | none | Get account details |
⚙️ Advanced Usage
Manual Status Reconciliation
import time
time.sleep(10)
status = sms.get_status(
'fe424939fc3c4b6dbcc876994517d712',
'0761234567'
)
print(status)
🇱🇰 Sri Lankan Number Formatting
The SDK automatically formats numbers:
0761234567 → 94761234567
761234567 → 94761234567
+94761234567 → 94761234567
🔔 Webhook Integration (Recommended)
FitSMS v4 uses webhooks for real-time delivery updates.
Sample Webhook Payload
{
"status": "success",
"data": {
"to": "94770000000",
"from": "MyBrand",
"message": "Test",
"ruid": "fe424939fc3c4b6dbcc876994517d712",
"received_at": "2026-03-28T23:24:22+05:30"
}
}
Example Flask Webhook
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/sms-webhook', methods=['POST'])
def sms_webhook():
data = request.json
print("SMS Status Update:", data)
# Example DB update
# update_message_status(data['data']['ruid'], data['data']['status'])
return jsonify({'status': 'ok'})
🛡 Best Practices
- Use environment variables:
import os
api_token = os.getenv('FITSMS_API_TOKEN')
- Store and index
ruidin your database - Log all API responses
- Prefer webhooks over polling
📄 License
This project is licensed under the MIT License.
🤝 Contributing
Contributions, issues, and feature requests are welcome!
👨💻 Maintainer
Maintained by Global Cloud Media (pvt) Ltd.
Metadata
Release files for fitsms 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fitsms-1.0.2.tar.gz | 4.1 kB | Without provenance | Details for fitsms-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fitsms-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for fitsms-1.0.2-py3-none-any.whl |
Total release size: 8.3 kB
Release files / fitsms-1.0.2.tar.gz
| Download URL | fitsms-1.0.2.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a6f1977edc24ec394d63cbeff266cedd86a9048550eb30488efb397c68be2255
|
|
BLAKE2b-256 checksum How to use checksums |
f39d7f59e9fa85abc34cc1410fc9f5a6c2d837aaf83cc3e48bbe251dedfc3997
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / fitsms-1.0.2-py3-none-any.whl
| Download URL | fitsms-1.0.2-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb27ca8aec6915c9eaeb879d45baa3f7a7feffc412f182738ba0b2b461d3da39
|
|
BLAKE2b-256 checksum How to use checksums |
d552fcce43c00188ad8a1f6c5f46b5e38569f30d7e4608750bd969209dd4bab5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for fitsms 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.