def apply_actions(self, name_of_action, actions):
        """Start to execute an action or a group of actions.

        This method takes a bunch of actions and runs them on your
        Tahoma box.

        :param name_of_action: the label/name for the action
        :param actions: an array of Action objects
        :return: the execution identifier  **************
        what if it fails
        :rtype: string

        raises ValueError in case of protocol issues

        :Seealso:

        - get_events
        - get_current_executions
        """
        header = BASE_HEADERS.copy()
        header['Cookie'] = self.__cookie

        actions_serialized = []

        for action in actions:
            actions_serialized.append(action.serialize())

        data = {"label": name_of_action, "actions": actions_serialized}
        json_data = json.dumps(data, indent=None, sort_keys=True)

        request = requests.post(
            BASE_URL + "apply",
            headers=header, data=json_data,
            timeout=10)

        if request.status_code != 200:
            self.__logged_in = False
            self.login()
            self.apply_actions(name_of_action, actions)
            return

        try:
            result = request.json()
        except ValueError as error:
            raise Exception(
                "Not a valid result for applying an " +
                "action, protocol error: " + request.status_code +
                ' - ' + request.reason + " (" + error + ")")

        if 'execId' not in result.keys():
            raise Exception("Could not run actions, missing execId.")

        return result['execId']
def apply_actions ( self , name_of_action , actions ) : header = BASE_HEADERS . copy ( ) header [ 'Cookie' ] = self . __cookie actions_serialized = [ ] for action in actions : actions_serialized . append ( action . serialize ( ) ) data = { "label" : name_of_action , "actions" : actions_serialized } json_data = json . dumps ( data , indent = None , sort_keys = True ) request = requests . post ( BASE_URL + "apply" , headers = header , data = json_data , timeout = 10 ) if request . status_code != 200 : self . __logged_in = False self . login ( ) self . apply_actions ( name_of_action , actions ) return try : result = request . json ( ) except ValueError as error : raise Exception ( "Not a valid result for applying an " + "action, protocol error: " + request . status_code + ' - ' + request . reason + " (" + error + ")" ) if 'execId' not in result . keys ( ) : raise Exception ( "Could not run actions, missing execId." ) return result [ 'execId' ]
Start to execute an action or a group of actions.

        This method takes a bunch of actions and runs them on your
        Tahoma box.

        :param name_of_action: the label/name for the action
        :param actions: an array of Action objects
        :return: the execution identifier  **************
        what if it fails
        :rtype: string

        raises ValueError in case of protocol issues

        :Seealso:

        - get_events
        - get_current_executions