|
Python module which can be used to send SMS messages via the Clickatell HTTPS API. Does not requires pycurl (as the original version), but uses urllib instead. Example usageimport md5
from clickatell import Clickatell
ct = Clickatell("username", "password", 'clientid')
phone = "999999"
text = "Test"
if not ct.auth():
raise Exception("Can't authenticate!")
hasher = md5.new()
hasher.update(phone)
hasher.update(text)
msg_id = hasher.hexdigest()
message = {
'to': str(phone),
'text': str(text),
'climsgid': str(msg_id)
}
res, msg = ct.sendmsg(message)
if not res:
raise Exception("Failed to send a message '%s' to %s: %s!" % (text, phone, msg))
|