def setBoiler(request): caldera = Boiler() try: if request.POST["state"] == "on": content = caldera.turnOn() elif request.POST["state"] == "off": content = caldera.turnOff() else: content = {"state": "Format not recognized"} except MultiValueDictKeyError: content = {"state": request} return Response(content)
def setBoiler(request): caldera = Boiler() try: if request.POST['state'] == 'on': content = caldera.turnOn() elif request.POST['state'] == 'off': content = caldera.turnOff() else: content = {'state': 'Format not recognized'} except MultiValueDictKeyError: content = {'state': request} return Response(content)
def turnOff(request): caldera = Boiler() content = caldera.turnOff() return Response(content)
def check(request): caldera = Boiler() content = caldera.getState() return Response(content)