initial commit
This commit is contained in:
24
twilio_send.py
Normal file
24
twilio_send.py
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
from twilio.rest import Client
|
||||
import configparser
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read("secrets.env")
|
||||
|
||||
account_sid = config["TWILIO"]["account_sid"]
|
||||
auth_token = config["TWILIO"]["auth_token"]
|
||||
reciver_number = config["TWILIO"]["to_nr"]
|
||||
sender_number = config["TWILIO"]["from_nr"]
|
||||
client = Client(account_sid, auth_token)
|
||||
|
||||
|
||||
def send_sms(payload):
|
||||
message = client.messages \
|
||||
.create(
|
||||
body=payload,
|
||||
from_=sender_number,
|
||||
to=reciver_number
|
||||
)
|
||||
|
||||
print(message.status)
|
||||
Reference in New Issue
Block a user