Skip to content

Instantly share code, notes, and snippets.

@sripathikrishnan
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save sripathikrishnan/9968008 to your computer and use it in GitHub Desktop.

Select an option

Save sripathikrishnan/9968008 to your computer and use it in GitHub Desktop.
Twilio Stateless SMS Client
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