###############################################
##   Ozeki NG - SMS Gateway Python example   ##
###############################################

import urllib

###############################################
###            Ozeki NG informations        ###
###############################################

host = "http://127.0.0.1"
user_name = "admin"
user_password = "abc123"
recipient = "+36304080332"
message_body = "Hello World from Python"

###############################################
### Putting together the final HTTP Request ###
###############################################

http_req = host
http_req += ":9501/api?action=sendmessage&username="
http_req += urllib.quote(user_name)
http_req += "&password="
http_req += urllib.quote(user_password)
http_req += "&recipient="
http_req += urllib.quote(recipient)
http_req += "&messagetype=SMS:TEXT&messagedata="
http_req += urllib.quote(message_body)

################################################
####            Sending the message          ###
################################################
get = urllib.urlopen(http_req)
req = get.read()
get.close()

###############################################x
###        Verifying the response            ###
##############################################x#

if req.find("Message accepted for delivery") > 1:
    print "Message successfully sent"
else:
    print "Message not sent! Please check your settings!"