dmnobunaga
1/22/2014 - 3:16 AM

Example of usage ByteHand.com service

Example of usage ByteHand.com service

# -*- coding: utf-8 -*-
# License CC BY
__author__ = 'dm.nobunaga@gmail.com'
import requests

url = "http://bytehand.com:3800/send"
bytehandId = 0000 
bytehandKey = "XXXXXXXXXXXXXXXX"
bytehandFrom = "SMS-Info"


def sendSMS(bytehandto, bytehandtext):
    global url
    global bytehandId
    global bytehandKey
    global bytehandFrom

    data = {
        "id": bytehandId,
        "key": bytehandKey,
        "from": bytehandFrom,
        "to": bytehandto,
        "text": bytehandtext
    }
    r = requests.get(url=url, params=data)
    if r.status_code == 200:
        return True
    else:
        #print r.text # Uncomment for debug purposes
        return False

#Example usage
print sendSMS("79161234567", "Test");