Created
January 10, 2016 08:30
-
-
Save rezkam/99d579265ec69b9fd7cb to your computer and use it in GitHub Desktop.
SMS Send Code for axonsms.com Webservice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Python Sample Code for axonsms.com SMS Panel | |
Mohammad Reza Kamalifard [email protected] | |
To Use this code you need to install suds from pip | |
$> pip install suds | |
''' | |
from suds.client import Client | |
# Define statics | |
WEB_SERVICE_URL = 'http://www.axonsms.com/services/SMSBox/wsdl' | |
SMS_PHONE_NUMBER = 'Put_your_phone_number_here' | |
PASSWORD = 'Your_Password' | |
# Build the Client object | |
client = Client(WEB_SERVICE_URL) | |
class Message: | |
@staticmethod | |
def send(recipient_list, message_list): | |
f = client.factory | |
Auth = f.create('Auth') | |
Auth['number'] = SMS_PHONE_NUMBER | |
Auth['pass'] = PASSWORD | |
recipients = f.create('ArrayOfString') | |
recipients['string'] = [recipient_list] | |
message = f.create('ArrayOfString') | |
message['string'] = [message_list] | |
res = client.service.Send(Auth=Auth, | |
Recipients=recipients, | |
Message=message) | |
if res['Status'] == 1000: | |
return 'Sent Successfuly' | |
else: | |
return 'Not Successful with Error code %s' % res['Status'] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment