Created
March 15, 2019 16:54
-
-
Save thinkingserious/9383ba2f509ba030c931810d97492188 to your computer and use it in GitHub Desktop.
Send a SMS via Twilio and Pythonista on iOS
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
import requests | |
from requests.auth import HTTPBasicAuth | |
to_number = 'outgoing_number' | |
from_number = 'your_twilio_number' | |
message = 'Thank for your order, we will deliver after our cookie booth sale at around 6pm.' | |
account_sid = 'your_account_sid' | |
auth_token = 'your_auth_token' | |
auth = HTTPBasicAuth(account_sid, auth_token) | |
url = 'https://api.twilio.com/2010-04-01/Accounts/{}/Messages'.format(account_sid) | |
values = { | |
'To' : to_number, | |
'From' : from_number, | |
'Body' : message, | |
} | |
response = requests.post(url, data = values, auth = auth) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment