Created
July 27, 2010 18:20
-
-
Save SeanOC/492617 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import twilio | |
import time | |
# Setup twilio info | |
API_VERSION = '2008-08-01' | |
ACCOUNT_SID = 'REPLACE_ME' | |
ACCOUNT_TOKEN = 'REPLACE_ME' | |
account = twilio.Account(ACCOUNT_SID, ACCOUNT_TOKEN) | |
FROM_NUMBER = '(555) 555-5555' | |
TO_NUMBER = '(555) 555-5555' | |
# Wait for something to happen | |
happened = False | |
while not happened: | |
happened = test_that_something_happened() | |
if not happened: | |
time.sleep(30) | |
# When it happens send a text message | |
if happened: | |
d = { | |
'From': FROM_NUMBER, | |
'To': TO_NUMBER, | |
'Body': 'It happened!', | |
} | |
account.request('/%s/Accounts/%s/SMS/Messages' % (API_VERSION, ACCOUNT_SID), 'POST', d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment