© 2016 ATEMON Technology Consultants LLP
License: MIT License (modified)
Website: http://www.atemon.com
Author: Varghese Chacko [email protected]
pip install Atemon-SMSAPI
from atemon.SMS import API
sms_api = API(
username=<Your User Name>,
password=<Your Password>,
sender_name=<Your Sender Name>,
)
rep = sms_api.send(message=<Message string>, number=<Receiver's mobile number>)
Create an instance of SMS API to send SMS.
from atemon.SMS import API
sms_api = API(
username=<Your User Name>,
password=<Your Password>,
sender_name=<Your Sender Name>,
number=[List of numbers],
message_type=[message type],
http_api=[http API URL],
)
- username - Your username for SMS API
- password - Your password for SMS API
- sender_name - Your sender name on SMS API
- number - If you wish to send message to same mobile number, you may set it here and need not pass mobile number to other funcetion calls. You can set a string as a number or pass a list of strings to send to multiple mobile numbers.
- message_type - The message type identifier by provider(transactional or promotional).
- For GreenAds Global
- 0 - Promotional
- 1 - Transactional
- 2 - Promotional with sender id.
- http_api - URL to HTTP API. Default value is http://sapteleservices.com/SMS_API/.
rep = sms_api.send(message=<Message string>)
- message - The message to be sent.
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo',
sender_name='UPDATE',
number='9999999999',
message_type=0,
)
rep = sms_api.send(message="Hello world")
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo',
sender_name='UPDATE',
number=['9999999999', '1111111111'],
message_type=0,
)
rep = sms_api.send(message="Hello world")
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo',
sender_name='UPDATE',
message_type=0,
)
rep = sms_api.send(
message="Hello world",
number='9999999999',
)
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo',
sender_name='UPDATE',
message_type=0,
)
rep = sms_api.send(
message="Hello world",
number=['9999999999', '1111111111'],
)
Note: If mobile number(s) is passed to send()
, the message is end ONLY to the number passed. The number(s) set via constructor will be ignored for that call. It will NOT replace the number(s) set via constructor
sms_api.schedule_sms(
message=<Message String>,
number=[mobile numbers],
scheduled_time=<Time to send SMS>,
message_type=[message type]
)
- Message - Your username for SMS API
- number - Mobile number to which the message to be delivered. Single number cpuld be set as a string or pass a list of strings to send to multiple mobile numbers.
- scheduled_time - Time at which message to be sent - Python's datetime.datetime object.
- message_type - The message type identifier by provider(transactional or promotional).
from datetime import datetime, timedelta
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo',
sender_name='UPDATE',
number='9999999999',
message_type=0,
)
rep = sms_api.schedule_sms(
message="Hello world",
scheduled_time=datetime.now() + timedelta(minutes=30)
)
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo',
sender_name='UPDATE',
number=['9999999999', '1111111111'],
message_type=0,
)
rep = sms_api.schedule_sms(
message="Hello world",
scheduled_time=datetime.now() + timedelta(minutes=30)
)
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo',
sender_name='UPDATE',
message_type=0,
)
rep = sms_api.schedule_sms(
message="Hello world",
number='9999999999',
scheduled_time=datetime.now() + timedelta(minutes=30)
)
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo',
sender_name='UPDATE',
message_type=0,
)
rep = sms_api.schedule_sms(
message="Hello world",
number=['9999999999', '1111111111'],
scheduled_time=datetime.now() + timedelta(minutes=30)
)
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo',
sender_name='UPDATE',
message_type=0,
)
rep = sms_api.schedule_sms(
message="Hello world",
number=['9999999999', '1111111111'],
scheduled_time=datetime(2018, 1, 1)
)
Note: If mobile number(s) is passed to send()
, the message is end ONLY to the number passed. The number(s) set via constructor will be ignored for that call. It will NOT replace the number(s) set via constructor
Note: scheduled_time need to be a valid datetime.datetime object. It's the developers freedom, how to set date. For dates in past, or in far future, its the API decides to accept or not or deny.
info = sms_api.get_balance_info()
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo'
)
info = sms_api.get_balance_info()
Note: Passed only necessary info to API. You may call get_balance_info()
on any sms_api Object.
info = sms_api.get_delivery_report(
from_date=<Start date>,
to_date=<End date>,
)
- from_date - Start date - Python's datetime.datetime object.
- to_date - End date - Python's datetime.datetime object.
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo'
)
info = sms_api.get_delivery_report(
from_date=datetime.datetime(2016, 12, 1),
to_date=datetime.datetime(2016, 12, 31),
)
Note: Passed only necessary info to API. You may call get_delivery_report()
on any sms_api Object.
info = sms_api.get_delivery_report(
from_date=<Start date>,
to_date=<End date>,
number=<Mobile number>
)
- from_date - Start date - Python's datetime.datetime object.
- to_date - End date - Python's datetime.datetime object.
- number - Number for which the report is taken.
from atemon.SMS import API
sms_api = API(
username='demo',
password='demo'
)
info = sms_api.get_delivery_report(
nu
from_date=datetime.datetime(2016, 12, 1),
to_date=datetime.datetime(2016, 12, 31),
)
Note: Passed only necessary info to API. You may call get_delivery_report()
on any sms_api Object.
You are requested to report bugs and/or contribute to the package. We will try our best to keep track of any pull requests or bug reports. A mail with package name in subject line, sent to [email protected]
, will get quicker attention :)