Esempio n. 1
0
    def __update_views(self,
                       visual_property,
                       values,
                       object_type=None,
                       key_type='suid'):
        if key_type == 'name':
            name2suid = NetworkUtil.name2suid(self.__network)

        body = []
        for key in values.keys():
            if key_type == 'name':
                try:
                    suid = name2suid[key]
                except KeyError:
                    continue
            else:
                suid = key

            new_value = self.__create_new_value(suid, visual_property,
                                                values[key])

            body.append(new_value)

        res = requests.put(self.__url + '/' + object_type,
                           json=body,
                           headers=HEADERS)
        check_response(res)
Esempio n. 2
0
    def update_network_view(self, visual_property=None, value=None):
        """
        Updates single value for Network-related VP.

        :param visual_property:
        :param value:
        :return:
        """

        new_value = [{"visualProperty": visual_property, "value": value}]
        res = requests.put(self.__url + '/network',
                           data=json.dumps(new_value),
                           headers=HEADERS)
        check_response(res)
Esempio n. 3
0
    def __batch_update(self, df, object_type=None):
        body = []

        columns = df.columns
        for index, row in df.iterrows():
            entry = {
                'SUID': int(index),
                'view': self.__create_new_values_from_row(columns, row)
            }
            body.append(entry)

        res = requests.put(self.__url + '/' + object_type,
                           data=json.dumps(body),
                           headers=HEADERS)

        check_response(res)