예제 #1
0
    def update(self, uuid, attributes):
        ''' update attributes for an id where attributes is a dictionary'''

        if not uuid_format(uuid):
            raise TypeError

        return self.http_post("%s%s%s" % (self.id_service, self.ID_PATH, uuid),
                              json.dumps(attributes)).text
예제 #2
0
    def update(self, uuid, attributes):
        ''' update attributes for an id where attributes is a dictionary'''

        if not uuid_format(uuid):
            raise TypeError

        return self.http_post("%s%s%s" % (self.id_service, self.ID_PATH,
                uuid), json.dumps(attributes)).text
예제 #3
0
    def get_id_info(self, uuid, as_ids=False):
        ''' Given a uuid return that files metadata as a uuid '''

        if not uuid_format(uuid):
            raise TypeError

        resp = self.http_get("%s%s%s" % (self.id_service, self.ID_PATH, uuid))

        if resp.status_code != 200:
            return {}

        object_info = json.loads(resp.text)

        if "ids" in object_info:
            if as_ids:
                return [obj for obj in object_info["ids"]]
            return [self.get_id_info(obj) for obj in object_info["ids"]]

        if type(object_info) is list:
            objects = [self.object_info_factory(obj) for obj in object_info]
            return objects

        return self.object_info_factory(object_info)
예제 #4
0
    def get_id_info(self, uuid, as_ids=False):
        ''' Given a uuid return that files metadata as a uuid '''

        if not uuid_format(uuid):
            raise TypeError

        resp = self.http_get("%s%s%s" % (self.id_service, self.ID_PATH, uuid))

        if resp.status_code != 200:
            return {}

        object_info = json.loads(resp.text)

        if "ids" in object_info:
            if as_ids:
                return [obj for obj in object_info["ids"]]
            return [self.get_id_info(obj) for obj in object_info["ids"]]

        if type(object_info) is list:
            objects = [self.object_info_factory(obj) for obj in object_info]
            return objects

        return self.object_info_factory(object_info)