magfa-client is a python client library for interacting with magfa SMS webservice v2.
Project description
📡 MagfaSMS Python Client
A simple and clean Python client for interacting with
the Magfa SMS HTTP API v2.
This library allows you to send SMS messages, check message statuses, retrieve inbound messages, and monitor your
account balance.
🚀 Features
- ✅ Send SMS messages to multiple recipients
- 🔄 Track the delivery status of sent messages
- 📥 Fetch inbound (received) messages
- 💰 Check your Magfa account balance
- 🧾 Error code mapping for human-readable error handling
- 🔒 Built-in authentication with domain-based credentials
📦 Installation
pip install magfa
🛠️ Usage
🔐 Initialization
from magfa_sms import MagfaSMS
client = MagfaSMS(
username="your_username",
password="your_password",
domain="your_domain",
sender="your_sender_number"
)
✉️ Send an SMS
response = client.send(
recipients=["09123456789"],
messages=["Hello from Magfa!"]
)
print(response.json())
📊 Check Balance
balance_response = client.balance()
print(balance_response.json())
📩 Get Inbound Messages
inbound = client.messages(count=50)
print(inbound.json())
📡 Get Message Status
status = client.statuses(mid="123456789")
print(status.json())
🧠 Error Code Mapping
error_text = MagfaSMS.get_error_message(18)
print(error_text) # Output: Invalid username or password.
🚧 Configuration
| config name | description | type | status |
|---|---|---|---|
| MAGFA_DEBUG | log all requests/responses in stdout | environment variable | Optional |
for enabling DEBUG mode you can directly pass debug option for magfa class or set an environment variable
called MAGFA_DEBUG with string value ("True", "False")
from magfa import Magfa
magfa_client = Magfa(..., debug=False)
📚 Resources
Star History
🧑💻 Author
Developed by Ali Sharify
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file magfa-1.0.0.tar.gz.
File metadata
- Download URL: magfa-1.0.0.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17f6c7d30a27065b29817e42086b2c8929618a556d2485a2b8da4779d792c01a
|
|
| MD5 |
b549c1fbabb95099ac7b7c899c032287
|
|
| BLAKE2b-256 |
5f090190d91f1ccdd2f14ebc163195be0e09f5f8762022a096264f6cbeda8c6e
|
File details
Details for the file magfa-1.0.0-py3-none-any.whl.
File metadata
- Download URL: magfa-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bb09cc2035dc3d22bff677028570c2d09668778d5a5338186fdb937113f16d8
|
|
| MD5 |
fa2469b3521ff50b66d3168532dfa640
|
|
| BLAKE2b-256 |
f03dba242fe61bd6d8a2c70e7952903769413e9da85e44d7a1d3338ee7235a3d
|