def api(self): input_json = cherrypy.request.json print input_json try: s = WakeupInfo("wakeup_info.json", [], [], "", "", "") s.refresh() if "arrivalTime" in input_json.keys(): s.time = input_json["arrivalTime"].encode("ascii", "ignore") if "breakfastTime" in input_json.keys(): s.brekfast_time = input_json["breakfastTime"].encode("ascii", "ignore") s.save() except: print "API key time Error" else: print "Time updated! {0} and {1}".format(s.time, s.brekfast_time) if "alarmStatus" in input_json.keys(): if input_json["alarmStatus"] == "silence": self.silence = True if "url" in input_json.keys(): self.phone_url = input_json["url"] print "URL updated!" return "Hello. This is our API"