def configured_app(): app = CaryApp() app.allowed_addresses = ['*****@*****.**'] app.return_address = "*****@*****.**" cmd = EchoCommand() app.add_command("echo", cmd) return app
def main(): parser = argparse.ArgumentParser(description="process email message as an offline assistant") parser.add_argument("--settings", type=str, help="name of the local settings module", default="local_conf.py") parser.add_argument("--fetch", action="store_true", help="if true, fetch from pop3 instead of reading from stdin") args = parser.parse_args() config = SourceFileLoader("local_conf", args.settings).load_module() setup_logging(config) app = CaryApp() configure_cary(app, config) if args.fetch: msgs, ids = messages(app.pop_host, app.pop_port, app.pop_use_ssl, app.pop_user, app.pop_password) for msg in msgs: process_message(app, msg) if app.pop_delete_messages: delete_messages(app.pop_host, app.pop_port, app.pop_use_ssl, app.pop_user, app.pop_password, ids) else: msg = sys.stdin.read() app.process_message(app, msg)