Skip to content

Instantly share code, notes, and snippets.

@rezkam
Created January 10, 2016 08:30
Show Gist options
  • Save rezkam/99d579265ec69b9fd7cb to your computer and use it in GitHub Desktop.
Save rezkam/99d579265ec69b9fd7cb to your computer and use it in GitHub Desktop.
SMS Send Code for axonsms.com Webservice
'''
Python Sample Code for axonsms.com SMS Panel
Mohammad Reza Kamalifard mr.kamalifard@gmail.com
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