Since you’re willing to install third-party packages (I see a pip install -r requirements.txt step in your README), there are a couple of packages you can install that will probably be quite useful for your code. If you are curious or find this script useful the updated version, containing many of the useful suggestions received here, is available on my GitHub # Push notification parameters (Pushbullet)
# Push notification parameters (Pushover) # Please fill in your data and make sure this configuration file is not readable by other users Send_pushbullet_notification(sys.argv, sys.argv)Īnd here's the config file: # Email has been tested using and port 587 Send_email(EMAIL_SUBJECT, EMAIL_MESSAGE, EMAIL_RECIPIENTS) Print 'Pushover Example: -pushover "Message"' Print 'Pusbullet Example: -pushbullet "Title" "Message"' Print 'Email Example: -email "Email Subject" "Email Message" "Email recipients"' "token": notification_config.PUSHOVER_APP_TOKEN, This functions sends a notification using PushoverĬonn = httplib.HTTPSConnection("") ndmail(notification_config.EMAIL_SENDER, recipients, msg.as_string()) Server.login(notification_config.EMAIL_SENDER, notification_config.EMAIL_PASSWORD) If notification_config.EMAIL_DEBUG_LEVEL = '1': nnect(notification_config.EMAIL_SERVER, notification_config.EMAIL_SERVER_PORT) This functions sends a notification using EmailĮmail_recipients (str) : Email recipients. # Please put your data into configure.py before using this scriptĭef send_email(email_subject, notification_msg, email_recipients): In case anybody is much more comfortable with git than with copy/paste: git clone My main problem is that the only security offered is coming from the OS filesystem settings (making the config file not readable to other users) and I would be very happy to improve my code and make it more secure. I would be glad to receive general suggestions / feedback. I have built a tiny script to send out push notifications.