def interpreter(): ciu_client = ciu.CiuClient() while True: state, connection = get_state(ciu_client) points = ciu_client.ciu_points() print_cmd_prompts(state, connection, points) cmd = input("command?: ") index = int_value(cmd) if index: password = "" if points[index - 1]["security"] == "encrypted": password = getpass("password: "******"ssid"], password) elif cmd == "m": ssid = input("ssid?: ") password = getpass("password (if required)?: ") do_connect(ciu_client, ssid, password) elif cmd == "n": name = input("new host name?: ") do_name(ciu_client, name) else: try: print() commands[cmd].fn(ciu_client, connection) except KeyError: print("\nInvalid command\n")
def interpreter(): ciu_client = ciu.CiuClient() while True: state, connection = get_state(ciu_client) points = ciu_client.ciu_points() print_cmd_prompts(state, connection, points) cmd = input("command?: ") index = int_value(cmd) if index: password = "" if points[index - 1]['security'] == 'encrypted': password = getpass('password: '******'ssid'], password) elif cmd == 'm': ssid = input("ssid?: ") password = getpass('password (if required)?: ') do_connect(ciu_client, ssid, password) else: try: commands[cmd].fn(ciu_client, connection) except KeyError: print("\nInvalid command\n")
def main(): log = deflog() log.info("Starting comitup-web") global ciu_client ciu_client = ciu.CiuClient() ciu_client.ciu_state() ciu_client.ciu_points() app = create_app(log) app.run(host="0.0.0.0", port=80, debug=False, threaded=True)
def one_shot(cmdlist: List[str]): cmd = cmdlist[0] if cmd not in commands: print("Invalid command {}".format(cmd)) return if not commands[cmd].scriptable: print("Command is not scriptable") return ciu_client = ciu.CiuClient() state, connection = get_state(ciu_client) if cmd == "m": print("Attempting to connect to {}".format(cmdlist[1])) do_connect(ciu_client, *cmdlist[1:]) elif cmd == "n": do_name(ciu_client, *cmdlist[1:]) else: commands[cmd].fn(ciu_client, connection)
# SPDX-License-Identifier: GPL-2+ # License-Filename: LICENSE import time from multiprocessing import Process if __name__ == '__main__': import os import sys fullpath = os.path.abspath(__file__) parentdir = '/'.join(fullpath.split('/')[:-2]) sys.path.insert(0, parentdir) from comitup import client ciu = client.CiuClient() def kickNM(delay=0): time.sleep(delay) ciu.ciu_state() ciu.ciu_points() def kickNMProc(*, delay=5, async=True): p = Process(target=kickNM, args=(delay, )) p.start() if not async: p.join()
def main(): global ciu_client ciu_client = ciu.CiuClient() app = create_app() app.run(host="0.0.0.0", port=80, debug=True, threaded=True)