I was tired of waiting for pipelines to finish, refreshing the web browser, or looking at my log files. So I decided to create a toolkit for myself, with which I could receive the progress of the pipelines through mails or texts.
pip install -i https://test.pypi.org/simple/ dougs-noti
from dougs_noti import noti
import os
# NAVER_MAIL and NAVER_PW should be saved as environment variables before running the code
sender_email = os.environ.get("NAVER_MAIL")
sender_password = os.environ.get("NAVER_PW")
noti.send_email(sender_email=sender_email, sender_password=sender_password, to_email='[email protected]',
mail_body='hello!', mail_subject='attachment part1.csv')
# TWILIO_SID and TWILIO_AUTH_TOKEN should be saved as environment variables before running the code
to_number = '+142446...'
from_number = '+18449991359'
account_sid = os.environ.get("TWILIO_SID")
auth_token = os.environ.get("TWILIO_AUTH_TOKEN")
noti.send_text(account_sid=account_sid, auth_token=auth_token, from_number=from_number, to_number=to_number, text_body="Sending test #4")
send_email
(function) def send_email(
sender_email: str,
sender_password: str,
to_email: List[str],
smtp_server: str = None,
smtp_port: str = None,
file_loc: str = None,
mail_body: str = 'this is message generated from s',
mail_subject: str = <Expression>
) -> bool
sender_email : email you will use to send the alert
sender_password : password for the email you will use to send the alert
to_email : email that will get the alert
ex)'[email protected]'
smtp_server : smtp server for your sender email. If we have the smtp server of your email provider in our db, you might not need to input it ex) gmail.com -> smtp.gmail.com
smtp_port : smtp server for your sender email. If we have the smtp port of your email provider in our db, you might not need to input it ex) gmail.com -> 587 file_loc : full directory of the attachement file (default : None)
mail_body : the content of the mail
mail_subject : the subject of the mail
send_text
(function) def send_text(
account_sid: str,
auth_token: str,
from_number: str,
to_number: str,
text_body: str
) -> None
account_sid : account id of twilio account. see the READ.MD on how you can get it
auth_token : authorization token for twilio services see the READ.MD on how you can get it
from_number : the number you will use to send the text. This should be provided by Twilio. Read the READ.MD for how you should get it
to_number : the number that will get the text
text_body : content of the text
- Go to Gmail account settings → security
- Search for
app passwords
and clickapp passwords
- Generate Corresponding password
- Copy and assign it as a environment variable
export GMAIL_PW='jeho....'
1. Go to Twilio.com and sign up
4. Go to https://console.twilio.com/ and get your Twilio Number you will use to send the texts
# Assign the variables in your terminal
export TWILIO_SID='AC780838d9c334e9d3b2f3ea55a052ddd6'
export TWILIO_AUTH_TOKEN='e28200aa90c...'
import os
# Number you're sending the text message to
to_number = '+1424468..'
# Number you're using to send the text message (Step 4)
from_number = '+18449991359'
# Account_sid you got in step 3
account_sid = os.environ.get("TWILIO_SID")
# Account Auth token you got in step 3
auth_token = os.environ.get("TWILIO_AUTH_TOKEN")
# Call the function
send_text(account_sid=account_sid, auth_token=auth_token, from_number=from_number, to_number=to_number, text_body="Sending test #3")