Created
May 15, 2020 09:05
-
-
Save jamescalam/60c58a9b90042cfdad3a669ae743bd94 to your computer and use it in GitHub Desktop.
Example code using sending email notification on completion of a cash-flow model process.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
end = datetime.datetime.now() # get the ending datetime | |
# get the total runtime in hours:minutes:seconds | |
hours, rem = divmod((end - start).seconds, 3600) | |
mins, secs = divmod(rem, 60) | |
runtime = '{:02d}:{:02d}:{:02d}'.format(hours, mins, secs) | |
# now built our message | |
notify.msg( | |
subject="Cashflow Model Completion", | |
text=(f'{len(model.output)} loans processed.\n' | |
f'Total runtime: {runtime}'), | |
img=[ | |
'../vis/loan01_amortisation.png', | |
'../vis/loan07_amortisation.png', | |
'../vis/loan01_profit_and_loss.png', | |
'../vis/loan07_profit_and_loss.png' | |
] | |
) | |
notify.send(msg) # and send it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment