Created
June 6, 2017 00:37
-
-
Save erinxocon/cac8d321938c9ae6a913b77beec999f8 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
from twilio.rest import Client | |
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.connect(("8.8.8.8", 80)) | |
ip = s.getsockname()[0] | |
s.close() | |
# Your Account SID from twilio.com/console | |
account_sid = 'YOUR_ACCOUNT_SID' | |
# Your Auth Token from twilio.com/console | |
auth_token = 'YOUR AUTH TOKEN' | |
client = Client(account_sid, auth_token) | |
message = client.messages.create( | |
to='+17034890215', | |
from_='+19097666394', | |
body='Uh oh! Looks like the raspberry pi had to reboot, your current IP address is {0}. Please adjust your app config as needed!'.format(ip)) | |
print(message.sid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
add this to your rc.local or crontab file for use at startup!