set an imap timeout
so pylokid stops when the IMAP server doesn't respond in time https://stackoverflow.com/questions/24422724/does-pythons-imaplib-let-you-set-a-timeout
This commit is contained in:
parent
e46e21b486
commit
6114573591
|
@ -7,6 +7,7 @@ import logging
|
|||
import re
|
||||
import email
|
||||
import email.parser
|
||||
import socket
|
||||
import imaplib
|
||||
|
||||
_EMAIL_SUBJECTS = '(OR OR SUBJECT "Einsatzausdruck_FW" SUBJECT "Einsatzprotokoll" SUBJECT "Einsatzrapport" UNSEEN)'
|
||||
|
@ -19,6 +20,7 @@ class EmailHandling:
|
|||
self.logger.info('Connecting to IMAP server %s', server)
|
||||
|
||||
self.tmp_dir = tmp_dir
|
||||
socket.setdefaulttimeout(60)
|
||||
try:
|
||||
# TODO timeout
|
||||
self.imap = imaplib.IMAP4_SSL(server)
|
||||
|
|
Loading…
Reference in New Issue