Very simple and easy to use Python 3 library for integrating SSLWireless SMS API.
Installation
using virtual environment (pipenv)
pipenv install ismslib
using pip globally
python3 -m pip install ismslib
Example
from ismslib import ISMS
config = {
"username": '<user>',
"password": '<pass>',
"sid": '<SID>',
}
response = ISMS.set_config(config)\
.set_body("আসসালামু আলাইকুম").make_unicode()\
.set_recipient(['88018XXXXXXXX', '88019XXXXXXXX'])\
.send()
print(response) if response['error'] else print('success')
Usage
1. First we import the library
from ismslib import ISMS
2. Set Credentials
Create a dictionary with user credentials obtained from SSLWireless.
config = {
"username": '',
"password": '',
"sid": '',
}
3. Set data
Call needed methods with valid data
ISMS.set_config(config)
ISMS.set_body("আসসালামু আলাইকুম")
ISMS.make_unicode()
ISMS.set_recipient(['88018XXXXXXXX', '88019XXXXXXXX'])
ISMS.set_debug(True)
response = ISMS.send()
optionally, methods can be chained together
response = ISMS.set_config(config)\
.set_body("আসসালামু আলাইকুম").make_unicode()\
.set_recipient(['88018XXXXXXXX', '88019XXXXXXXX'])\
.set_debug()\
.send()
4. Check the returned response
We can print out the response in console
print(response) if response['error'] else print('success')
Return values
"send()" returns a dictionary containing 3 values
{'error': True, 'msg': 'Login FAILED. Please check your username and password.', 'json': '{"REPLY": {"PARAMETER": "OK", "LOGIN": "FAIL"}}'}
1. error [boolean] : False if SMS sent successfully, True on error
2. msg [string] : Error message. Explains the reason of failure.
3. json [json string] : Raw API response, it's there if needed.
Contribution
Star ⭐ this repo if you find it useful. Any feedback is much appreciated. For official support / user credentials, contact your Key Account Manager (KAM).