Skip to content

Instantly share code, notes, and snippets.

@bitchwhocodes
Last active August 29, 2015 14:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitchwhocodes/36694e45c030925bb02e to your computer and use it in GitHub Desktop.
Save bitchwhocodes/36694e45c030925bb02e to your computer and use it in GitHub Desktop.
Twilio Python AP from Raspberry Pi
import RPi.GPIO as GPIO
from twilio.rest import TwilioRestClient
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(25,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
try:
GPIO.wait_for_edge(25,GPIO.RISING)
print("button pressed")
ACCOUNT_SID = "[account id]"
AUTH_TOKEN = "[account token]"
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
client.messages.create(
to="{put number here}",
from_="{your twilio number}",
body="shit is getting weird",
)
except KeyboardInterrupt:
GPIO.cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment