Report: add send_at_exit method

This commit is contained in:
Benjamin Renard 2021-04-19 14:55:07 +02:00
parent 4d91675d7a
commit 2c442a2433

View file

@ -3,6 +3,7 @@
""" Report """
import atexit
import logging
@ -56,3 +57,7 @@ class Report(object): # pylint: disable=useless-object-inheritance
text_body=content
)
return email_client.send(self.rcpt_to or rcpt_to, msg=msg, just_try=just_try)
def send_at_exit(self, **kwargs):
""" Send report at exit """
atexit.register(self.send, **kwargs)