예제 #1
0
    def _scene_control(self, scene_id, action):
        cmd = "sceneControl"
        params = {"id": scene_id, "action": action}
        resp = self.http_client.get(cmd, params=params)
        if resp.status_code != 202:
            exceptions.from_response(resp)

        return self.get(scene_id)
예제 #2
0
파일: devices.py 프로젝트: timmo-d/fiblary
    def action(self, device_id, action, *args):
        cmd = "callAction?deviceID={0}&name={1}".format(device_id, action)
        for i, arg in enumerate(args, 1):
            cmd = '{0}&arg{1}={2}'.format(cmd, i, arg)

        resp = self.http_client.get(cmd)
        if resp.status_code != 200 and resp.status_code != 202:
            exceptions.from_response(resp)
예제 #3
0
파일: devices.py 프로젝트: haklein/fiblary
    def action(self, device_id, action, *args):
        cmd = "/callAction?deviceID={0}&name={1}".format(device_id, action)
        for i, arg in enumerate(args, 1):
            cmd = '{0}&arg{1}={2}'.format(cmd, i, arg)

        resp = self.http_client.get(cmd)
        if resp.status_code != 200 and resp.status_code != 202:
            exceptions.from_response(resp)
예제 #4
0
파일: scenes.py 프로젝트: Seraf/fiblary
    def _scene_control(self, scene_id, action):
        cmd = "sceneControl"
        params = {
            "id": scene_id,
            "action": action
        }
        resp = self.http_client.get(cmd, params=params)
        if resp.status_code != 202:
            exceptions.from_response(resp)

        return self.get(scene_id)
예제 #5
0
파일: restapi.py 프로젝트: haklein/fiblary
 def _error_handler(self, response):
     if response.status_code < 200 or response.status_code > 300:
         self.logger.debug(
             "ERROR: %s",
             response.text,
         )
         raise exceptions.from_response(response)
     return response
예제 #6
0
 def _error_handler(self, response):
     if response.status_code < 200 or response.status_code > 300:
         self.logger.debug(
             "ERROR: %s",
             response.text,
         )
         raise exceptions.from_response(response)
     return response