mirror of
https://github.com/craigerl/aprsd.git
synced 2025-02-03 09:44:15 -05:00
Added a try block around imap login
This commit is contained in:
parent
81d01c3bc6
commit
89d038e93d
@ -214,8 +214,13 @@ def check_email_thread():
|
|||||||
(CONFIG['imap']['host'],
|
(CONFIG['imap']['host'],
|
||||||
CONFIG['imap']['login']))
|
CONFIG['imap']['login']))
|
||||||
|
|
||||||
server = IMAPClient(CONFIG['imap']['host'], use_uid=True)
|
try:
|
||||||
server.login(CONFIG['imap']['login'], CONFIG['imap']['password'])
|
server = IMAPClient(CONFIG['imap']['host'], use_uid=True, timeout=5)
|
||||||
|
server.login(CONFIG['imap']['login'], CONFIG['imap']['password'])
|
||||||
|
except Exception:
|
||||||
|
LOG.exception("Failed to login with IMAP server")
|
||||||
|
return
|
||||||
|
|
||||||
# select_info = server.select_folder('INBOX')
|
# select_info = server.select_folder('INBOX')
|
||||||
|
|
||||||
messages = server.search(['SINCE', today])
|
messages = server.search(['SINCE', today])
|
||||||
@ -460,12 +465,14 @@ def main(args=args):
|
|||||||
|
|
||||||
check_email_thread() # start email reader thread
|
check_email_thread() # start email reader thread
|
||||||
|
|
||||||
|
LOG.info("Start main loop")
|
||||||
while True:
|
while True:
|
||||||
line = ""
|
line = ""
|
||||||
try:
|
try:
|
||||||
for char in tn.read_until("\n",100):
|
for char in tn.read_until("\n",100):
|
||||||
line = line + char
|
line = line + char
|
||||||
line = line.replace('\n', '')
|
line = line.replace('\n', '')
|
||||||
|
print("ASS LINE %s" % line)
|
||||||
LOG.info(line)
|
LOG.info(line)
|
||||||
searchstring = '::' + user
|
searchstring = '::' + user
|
||||||
# is aprs message to us, not beacon, status, etc
|
# is aprs message to us, not beacon, status, etc
|
||||||
|
Loading…
Reference in New Issue
Block a user