Skip to content

Instantly share code, notes, and snippets.

@dmnobunaga
Last active January 4, 2016 02:09
Show Gist options
  • Save dmnobunaga/8552925 to your computer and use it in GitHub Desktop.
Save dmnobunaga/8552925 to your computer and use it in GitHub Desktop.
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");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment