I'm learning to use suds in a python script to send SQL queries to a database. I'd like to able to send myself an email when the query job is finished (it has a job ID so I'm able to check its status). How do I do that?
How to send myself an email notification when a suds job is done?
9k views Asked by user2612210 At
        	3
        	
        There are 3 answers
0
                
                        
                            
                        
                        
                            On
                            
                            
                                                    
                    
                I just wrote a Python decorator for this purpose. You can realize it in one line.
https://github.com/Wenzhi-Ding/py_reminder
from py_reminder import monitor
@monitor('SQL Query of xxx')
def query(sql):
    ...send your query...
query()
Once this function finishes / or is caught an error, you will get an email notification with some brief information.
0
                
                        
                            
                        
                        
                            On
                            
                            
                                                    
                    
                If email is not required, you can also send chat messages to yourself.
Two projects achieving this :
- Nimrod, for Facebook Messenger : https://www.nimrod-messenger.io/
 - Telegram Middleman, for Telegram : https://github.com/n1try/telegram-middleman-bot
 
This is how you send an email via python just fill in the blanks and input it to your code:
(you dont have to use gmail as most addresses will still work through the gmail smtp)