Last active
August 29, 2015 13:58
-
-
Save sripathikrishnan/9968008 to your computer and use it in GitHub Desktop.
Twilio Stateless SMS Client
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
| class TwilioSmsClient: | |
| def __init__(self, account_key, auth_key, sender, twilio_url): | |
| self.account_key = account_key | |
| self.auth_key = auth_key | |
| self.sender = sender | |
| self.uri = twilio_url | |
| def send_sms(self, phone_number, message): | |
| payload = { | |
| 'From': self.sender, | |
| 'To': str(kwargs['phone_number']), | |
| 'Body': kwargs['message'], | |
| } | |
| response = requests.post(url = url, data=payload, auth=(self.account_key, self.auth_key)) | |
| #skipping error handling for brevity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment