def on_response(response): cookies = utils.parse_cookies(response.headers.get_list('Set-Cookie')) motion_detected = cookies.get('motion_detected_' + str(camera_id)) == 'true' fps = cookies.get('capture_fps_' + str(camera_id)) fps = float(fps) if fps else 0 if response.error: logging.error('failed to get current picture for remote camera %(id)s on %(url)s: %(msg)s' % { 'id': camera_id, 'url': pretty_camera_url(local_config), 'msg': utils.pretty_http_error(response)}) return callback(error=utils.pretty_http_error(response)) callback(motion_detected, fps, response.body)
def on_response(response): cookies = utils.parse_cookies(response.headers.get_list('Set-Cookie')) motion_detected = cookies.get('motion_detected_' + str(camera_id)) == 'true' capture_fps = cookies.get('capture_fps_' + str(camera_id)) capture_fps = float(capture_fps) if capture_fps else 0 monitor_info = cookies.get('monitor_info_' + str(camera_id)) if response.error: logging.error('failed to get current picture for remote camera %(id)s on %(url)s: %(msg)s' % { 'id': camera_id, 'url': pretty_camera_url(local_config), 'msg': utils.pretty_http_error(response)}) return callback(error=utils.pretty_http_error(response)) callback(motion_detected, capture_fps, monitor_info, response.body)