def process_response(self, req: Request, resp: Response): if not req: return if req.method == Commands.ACTIVATE_COMMAND and resp.is_message(): self._prepare_service() if self._handler: self._handler.on_service_statistic_received(resp.result)
def process_response(self, req: Request, resp: Response): if not req: return if req.method == Commands.ACTIVATE_COMMAND and resp.is_message(): if self._handler: self._set_runtime_fields(resp.result[ServiceClient.HTTP_HOST], resp.result[ServiceClient.VODS_HOST], resp.result[ServiceClient.SUBSCRIBERS_HOST], resp.result[ServiceClient.BANDWIDTH_HOST], resp.result[ServiceClient.VERSION]) self._handler.on_service_statistic_received(resp.result) if req.method == Commands.PREPARE_SERVICE_COMMAND and resp.is_message(): for directory in resp.result: if Client.VODS_IN_DIRECTORY in directory: self._vods_in = directory[Client.VODS_IN_DIRECTORY]['content'] break
def generate_json_rpc_response_error(message: str, code: int, command_id: str) -> Response: return Response(command_id, None, {'code': code, 'message': message})
def generate_json_rpc_response_message(result, command_id: str) -> Response: return Response(command_id, result)