diff options
author | VG <vg@devys.org> | 2015-12-14 17:48:47 +0100 |
---|---|---|
committer | VG <vg@devys.org> | 2015-12-14 17:48:47 +0100 |
commit | dea2a328ccd3e64d4942e930878d33ce30167f55 (patch) | |
tree | 05e03b14ee1f3c601966d3a7f3f3ed7e6e348841 | |
parent | 539c9d074d1d84f452668f233cea3c1e7fde662e (diff) | |
download | climl-dea2a328ccd3e64d4942e930878d33ce30167f55.tar.gz climl-dea2a328ccd3e64d4942e930878d33ce30167f55.tar.bz2 climl-dea2a328ccd3e64d4942e930878d33ce30167f55.zip |
First tests reading a configuration file
-rw-r--r-- | climl_imap_bridge.py | 27 |
1 files changed, 27 insertions, 0 deletions
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 |