25 lines
632 B
Python
25 lines
632 B
Python
#!/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)
|