diff --git a/personal_data/main.py b/personal_data/main.py index d00f3ba..7d0326b 100644 --- a/personal_data/main.py +++ b/personal_data/main.py @@ -204,6 +204,9 @@ def main( cookiejar = [] logger.warning('No cookiejar is used') + if not send_email_notification: + logger.info('Email not enabled: Notifications will not be sent!') + for scraper_cls in available_scrapers(): session = get_session(cookiejar, with_cfscrape=scraper_cls.requires_cfscrape()) scraper = scraper_cls(session) @@ -230,10 +233,7 @@ def main( ) logger.info('Scraper done: %s', scraper.dataset_name) - if status['extended']: - if send_email_notification: - send_notification(session, scraper_cls.__name__, status['dicts'][-1]) - else: - logger.info('Email not enabled: Skipping notification') + if status['extended'] and send_email_notification: + send_notification(session, scraper_cls.__name__, status['dicts'][-1]) del scraper, session