1
0

Less spammy notification

This commit is contained in:
Jon Michael Aanes 2024-05-16 00:05:30 +02:00
parent f739df494a
commit 4c94cffe1b
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA

View File

@ -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:
if status['extended'] and send_email_notification:
send_notification(session, scraper_cls.__name__, status['dicts'][-1])
else:
logger.info('Email not enabled: Skipping notification')
del scraper, session