Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, on_cmd, off_cmd):
self.on_cmd = on_cmd
self.off_cmd = off_cmd
def on(self):
r = requests.get(self.on_cmd)
return r.status_code == 200
def off(self):
r = requests.get(self.off_cmd)
return r.status_code == 200
if __name__ == "__main__":
FAUXMOS = [
['office lights', dummy_handler("officelight")],
['kitchen lights', dummy_handler("kitchenlight")],
]
if len(sys.argv) > 1 and sys.argv[1] == '-d':
DEBUG = True
# Set up our singleton for polling the sockets for data ready
p = poller()
# Set up our singleton listener for UPnP broadcasts
u = upnp_broadcast_responder()
u.init_socket()
# Add the UPnP broadcast listener to the poller so we can respond
# when a broadcast is received.
p.add(u)
class rest_api_handler(object):
def __init__(self, on_cmd, off_cmd):
self.on_cmd = on_cmd
self.off_cmd = off_cmd
def on(self):
r = requests.get(self.on_cmd)
return r.status_code == 200
def off(self):
r = requests.get(self.off_cmd)
return r.status_code == 200
if __name__ == "__main__":
FAUXMOS = [
['office lights', dummy_handler("officelight")],
['kitchen lights', dummy_handler("kitchenlight")],
]
if len(sys.argv) > 1 and sys.argv[1] == '-d':
DEBUG = True
# Set up our singleton for polling the sockets for data ready
p = poller()
# Set up our singleton listener for UPnP broadcasts
u = upnp_broadcast_responder()
u.init_socket()
# Add the UPnP broadcast listener to the poller so we can respond
# when a broadcast is received.
p.add(u)
class rest_api_handler(object):
def __init__(self, on_cmd, off_cmd):
self.on_cmd = on_cmd
self.off_cmd = off_cmd
def on(self):
r = requests.get(self.on_cmd)
return r.status_code == 200
def off(self):
r = requests.get(self.off_cmd)
return r.status_code == 200
if __name__ == "__main__":
FAUXMOS = [
['office lights', dummy_handler("officelight")],
['kitchen lights', dummy_handler("kitchenlight")],
]
if len(sys.argv) > 1 and sys.argv[1] == '-d':
DEBUG = True
# Set up our singleton for polling the sockets for data ready
p = poller()
# Set up our singleton listener for UPnP broadcasts
u = upnp_broadcast_responder()
u.init_socket()
# Add the UPnP broadcast listener to the poller so we can respond
# when a broadcast is received.
p.add(u)
def __init__(self, on_cmd, off_cmd):
self.on_cmd = on_cmd
self.off_cmd = off_cmd
def on(self):
r = requests.get(self.on_cmd)
return r.status_code == 200
def off(self):
r = requests.get(self.off_cmd)
return r.status_code == 200
if __name__ == "__main__":
FAUXMOS = [
['office lights', dummy_handler("officelight")],
['kitchen lights', dummy_handler("kitchenlight")],
]
if len(sys.argv) > 1 and sys.argv[1] == '-d':
DEBUG = True
# Set up our singleton for polling the sockets for data ready
p = poller()
# Set up our singleton listener for UPnP broadcasts
u = upnp_broadcast_responder()
u.init_socket()
# Add the UPnP broadcast listener to the poller so we can respond
# when a broadcast is received.
p.add(u)