From ea93fc0048565f1fa40a6ddfa2a92fb696bb4fc9 Mon Sep 17 00:00:00 2001 From: VG Date: Fri, 13 May 2016 17:16:14 +0200 Subject: Add interupt handler while sleeping between retries --- climl/imap.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/climl/imap.py b/climl/imap.py index 14ecf2f..69e2117 100644 --- a/climl/imap.py +++ b/climl/imap.py @@ -145,7 +145,12 @@ def main(callback=None): for oneid in idlist: print('calling callback...') callback('mail: ' + str(oneid)) - except (socket.error, socket.timeout): + except (socket.error, socket.timeout, backports.ssl.SSLError): + print('socket/ssl error, retrying in 10s...') + try: + time.sleep(10) # wait between retries + except KeyboardInterrupt: + break pass except KeyboardInterrupt: break -- cgit v1.2.3