From dea2a328ccd3e64d4942e930878d33ce30167f55 Mon Sep 17 00:00:00 2001 From: VG Date: Mon, 14 Dec 2015 17:48:47 +0100 Subject: First tests reading a configuration file --- climl_imap_bridge.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 climl_imap_bridge.py diff --git a/climl_imap_bridge.py b/climl_imap_bridge.py new file mode 100644 index 0000000..8549a43 --- /dev/null +++ b/climl_imap_bridge.py @@ -0,0 +1,27 @@ +#!/usr/bin/python3 + +import os +import subprocess +import confparser +import imapclient + +def monitor_mailbox(server, port, user, password, conf): + if conf.ssl: + imapserv = imaplib.IMAP4_SSL(server, port) + else: + imapserv = imaplib.IMAP4(server, port) + if conf.starttls: + imapserv.starttls() + +def main(): + confpath = os.path.expanduser('~') + '/temp/conf.cfg' + conf = confparser.read_conf(confpath) + print('Read conf:', conf) + password_command = conf.get('imap.password_command', None) + if password_command: + password = subprocess.check_output(password_command, shell=True) + print('got pasword:', password) + + + +main() # dev mode for now -- cgit v1.2.3