Skip to content

Instantly share code, notes, and snippets.

@anroots
Created May 11, 2012 01:54
Show Gist options
  • Save anroots/2657032 to your computer and use it in GitHub Desktop.
Save anroots/2657032 to your computer and use it in GitHub Desktop.
A script to send SMS messages using Messente API
# -*- coding: utf-8 -*-
#!/usr/bin/python -tt
# A script to send SMS messages using Messente API
# Author Ando Roots 2011
import sys
import urllib
import urllib2
user = '921ffffdfs5lb5e17c910'; # API user
key = 'dc77360a20cir83n4bex14c1'; # API key
reciever = '3725850003'
msg = 'New grade!'
# Send SMS to reciever with the text msg
# See Messente API documentation for possible response codes
# If succesful, the first 2 chars are OK
def send_sms(reciever, msg):
api_url = 'https://messente.com/api/send_sms_get'
values = {'user' : user,
'api_key' : key,
'text' : msg,
'to' : reciever}
data = urllib.urlencode(values)
api_url = api_url + '?' + data
data = urllib.urlopen(api_url).read()
print data
def main():
send_sms(reciever, msg)
sys.exit(0)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment