From 878d8af1bfe875f32c7869f0db7f8b31a68fa101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Wed, 2 Aug 2017 20:13:40 +0200 Subject: [PATCH] quiet mail fetching --- mailing/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mailing/utils.py b/mailing/utils.py index b142a1b..a56e1f6 100644 --- a/mailing/utils.py +++ b/mailing/utils.py @@ -43,7 +43,6 @@ def fetch_imap_box(user, password, host, port=993, inbox='INBOX', trash='Trash') typ, data = M.uid('search', None, 'UNSEEN') if typ != 'OK': raise Exception(data[0].decode('utf-8')) - logging.info("Fetching %d messages" % len(data[0].split())) for num in data[0].split(): typ, data = M.uid('fetch', num, '(RFC822)') if typ != 'OK': @@ -84,7 +83,9 @@ def fetch_imap_box(user, password, host, port=993, inbox='INBOX', trash='Trash') if typ != 'OK': failure += 1 raise Exception(data[0].decode('utf-8')) - logging.info("Finished, success: %d, failure: %d" % (success, failure)) + if failure: + total = success + failure + logging.info("Total: %d, success: %d, failure: %d" % (total, success, failure)) def process_email(raw_email):