diff options
-rw-r--r-- | climl/imap.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/climl/imap.py b/climl/imap.py index 6bdcb04..0de15d8 100644 --- a/climl/imap.py +++ b/climl/imap.py @@ -3,7 +3,7 @@ import subprocess import confparser import imapclient import contextlib -import backports.ssl +import backports.ssl as ssl import socket import time @@ -145,7 +145,10 @@ def main(callback=None): for oneid in idlist: print('calling callback...') callback('mail: ' + str(oneid)) - except (socket.error, socket.timeout, backports.ssl.SSLError): + except (socket.error, + socket.timeout, + ssl.SSLError, + ssl.CertificateError): print('socket/ssl error, retrying in 10s...') try: time.sleep(10) # wait between retries @@ -153,10 +156,4 @@ def main(callback=None): break except KeyboardInterrupt: break - except Exception as e: - print('Unhandled exception during connection: ', e) - try: - time.sleep(10) # wait between retries - except KeyboardInterrupt: - break print('end of connection') |