def server(args): try: from socketio.server import SocketIOServer from ouimeaux.server import app, initialize except ImportError: print("ouimeaux server dependencies are not installed. Please run, e.g., 'pip install ouimeaux[server]'") sys.exit(1) initialize(bind=getattr(args, 'bind', None)) level = logging.INFO if getattr(args, 'debug', False): level = logging.DEBUG logging.basicConfig(level=level) try: # TODO: Move this to configuration listen = WemoConfiguration().listen or '0.0.0.0:5000' try: host, port = listen.split(':') except Exception: print("Invalid bind address configuration:", listen) sys.exit(1) SocketIOServer((host, int(port)), app, policy_server=False, namespace="socket.io").serve_forever() except (KeyboardInterrupt, SystemExit): sys.exit(0)
def server(args): try: from socketio.server import SocketIOServer from ouimeaux.server import app, initialize except ImportError: print( "ouimeaux server dependencies are not installed. Please run, e.g., 'pip install ouimeaux[server]'" ) sys.exit(1) initialize(bind=getattr(args, 'bind', None)) level = logging.INFO if getattr(args, 'debug', False): level = logging.DEBUG logging.basicConfig(level=level) try: # TODO: Move this to configuration listen = WemoConfiguration().listen or '0.0.0.0:5000' try: host, port = listen.split(':') except Exception: print("Invalid bind address configuration:", listen) sys.exit(1) SocketIOServer((host, int(port)), app, policy_server=False, namespace="socket.io").serve_forever() except (KeyboardInterrupt, SystemExit): sys.exit(0)
def server(args): from socketio.server import SocketIOServer from ouimeaux.server import app, initialize initialize() level = logging.INFO if getattr(args, "debug", False): level = logging.DEBUG logging.basicConfig(level=level) try: # TODO: Move this to configuration listen = WemoConfiguration().listen or "0.0.0.0:5000" try: host, port = listen.split(":") except Exception: print "Invalid bind address configuration:", listen sys.exit(1) SocketIOServer((host, int(port)), app, policy_server=False, namespace="socket.io").serve_forever() except (KeyboardInterrupt, SystemExit): sys.exit(0)
def server(args): from socketio.server import SocketIOServer from ouimeaux.server import app, initialize initialize() level = logging.INFO if getattr(args, 'debug', False): level = logging.DEBUG logging.basicConfig(level=level) try: # TODO: Move this to configuration listen = WemoConfiguration().listen or '0.0.0.0:5000' try: host, port = listen.split(':') except Exception: print "Invalid bind address configuration:", listen sys.exit(1) SocketIOServer((host, int(port)), app, policy_server=False, namespace="socket.io").serve_forever() except (KeyboardInterrupt, SystemExit): sys.exit(0)