forked from rdachere/whosthere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend_sms.py
31 lines (22 loc) · 967 Bytes
/
send_sms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
# Download the twilio-python library from http://twilio.com/docs/libraries
from twilio.rest import TwilioRestClient
import optparse
import sys
# Find these values at https://twilio.com/user/account
account_sid = "account id"
auth_token = "your auth token"
client = TwilioRestClient(account_sid, auth_token)
parser = optparse.OptionParser()
parser.add_option('-u', '--sms_url',
action="store", dest="sms_url",
help="sms url string", default="spam")
options, args = parser.parse_args()
if options.sms_url == "spam":
print "**** HEY! You forgot the URL for the SMS: ***"
print "**** Usage: send_sms -u <URL_string> ***"
sys.exit()
print '\n\n ************************ SENDING SMS WITH URL: ', options.sms_url ," *************************\n\n"
body_url = "Visitor @FrontDoor: " + options.sms_url
message = client.sms.messages.create(to="+XXXYYYZZZZ", from_="+XXXYYYZZZZ",
body=body_url)