Ejemplo n.º 1
0
        def _obj_index(b_path, m_path):
            f_list = []
            l_obj = None

            while True:
                resp = http.get_request(url=url, rpath=m_path, headers=fheaders)
                self.resp_exception(resp=resp)
                return_list = resp.json()

                for obj in return_list:
                    time_offset = ARGS.get("time_offset")
                    if time_offset is not None:
                        # Get the last_modified data from the Object.
                        if cloud.time_delta(lmobj=time_offset) is True:
                            f_list.append(obj)
                    else:
                        f_list.append(obj)

                last_obj_in_list = f_list[-1].get("name")
                if ARGS.get("max_jobs", ARGS.get("object_index")) is not None:
                    max_jobs = ARGS.get("max_jobs", ARGS.get("object_index"))
                    if max_jobs <= len(f_list):
                        return f_list[:max_jobs]
                    elif l_obj is last_obj_in_list:
                        return f_list
                    else:
                        l_obj = last_obj_in_list
                        m_path = _marker_type(base=b_path, last=last_obj_in_list)
                else:
                    if l_obj is last_obj_in_list:
                        return f_list
                    else:
                        l_obj = last_obj_in_list
                        m_path = _marker_type(base=b_path, last=last_obj_in_list)
Ejemplo n.º 2
0
 def _time_difference(obj_resp, obj):
     if ARGS.get("save_newer") is True:
         # Get the source object last modified time.
         compare_time = obj_resp.header.get("last_modified")
         if compare_time is None:
             return True
         elif cloud.time_delta(compare_time=compare_time, lmobj=obj["last_modified"]) is True:
             return False
         else:
             return True
     else:
         return True
Ejemplo n.º 3
0
 def _time_difference(resp, obj):
     if ARGS.get('save_newer') is True:
         # Get the source object last modified time.
         compare_time = resp.getheader('last_modified')
         if compare_time is None:
             return True
         elif cloud.time_delta(compare_time=compare_time,
                               lmobj=obj['last_modified']) is True:
             return False
         else:
             return True
     else:
         return True
Ejemplo n.º 4
0
 def _time_difference(resp, obj):
     if ARGS.get('save_newer') is True:
         # Get the source object last modified time.
         compare_time = resp.getheader('last_modified')
         if compare_time is None:
             return True
         elif cloud.time_delta(compare_time=compare_time,
                               lmobj=obj['last_modified']) is True:
             return False
         else:
             return True
     else:
         return True
Ejemplo n.º 5
0
        def _obj_index(b_path, m_path, l_obj, f_list):
            conn.request('GET', m_path, headers=fheaders)
            resp, read = http.response_get(conn=conn, retry=retry)
            self.resp_exception(resp=resp, rty=retry)
            return_list = basic.json_encode(read)

            for obj in return_list:
                time_offset = ARGS.get('time_offset')
                if time_offset is not None:
                    # Get the last_modified data from the Object.
                    if cloud.time_delta(lmobj=time_offset) is True:
                        f_list.append(obj)
                else:
                    f_list.append(obj)

            last_obj_in_list = f_list[-1].get('name')
            if l_obj is last_obj_in_list:
                return f_list
            else:
                marker = _marker_type(base=b_path, last=last_obj_in_list)
                _obj_index(b_path, marker, last_obj_in_list, f_list)
Ejemplo n.º 6
0
        def _obj_index(b_path, m_path):
            f_list = []
            l_obj = None

            while True:
                resp = http.get_request(url=url,
                                        rpath=m_path,
                                        headers=fheaders)
                self.resp_exception(resp=resp)
                return_list = resp.json()

                for obj in return_list:
                    time_offset = ARGS.get('time_offset')
                    if time_offset is not None:
                        # Get the last_modified data from the Object.
                        if cloud.time_delta(lmobj=time_offset) is True:
                            f_list.append(obj)
                    else:
                        f_list.append(obj)

                last_obj_in_list = f_list[-1].get('name')
                if ARGS.get('max_jobs', ARGS.get('object_index')) is not None:
                    max_jobs = ARGS.get('max_jobs', ARGS.get('object_index'))
                    if max_jobs <= len(f_list):
                        return f_list[:max_jobs]
                    elif l_obj is last_obj_in_list:
                        return f_list
                    else:
                        l_obj = last_obj_in_list
                        m_path = _marker_type(base=b_path,
                                              last=last_obj_in_list)
                else:
                    if l_obj is last_obj_in_list:
                        return f_list
                    else:
                        l_obj = last_obj_in_list
                        m_path = _marker_type(base=b_path,
                                              last=last_obj_in_list)
Ejemplo n.º 7
0
        def _obj_index(b_path, m_path, l_obj, f_list):
            conn.request('GET', m_path, headers=fheaders)
            resp, read = http.response_get(conn=conn, retry=retry)
            self.resp_exception(resp=resp, rty=retry)
            return_list = basic.json_encode(read)

            for obj in return_list:
                time_offset = ARGS.get('time_offset')
                if time_offset is not None:
                    # Get the last_modified data from the Object.
                    if cloud.time_delta(lmobj=time_offset) is True:
                        f_list.append(obj)
                else:
                    f_list.append(obj)

            last_obj_in_list = f_list[-1].get('name')
            if l_obj is last_obj_in_list:
                return f_list
            else:
                marker = _marker_type(base=b_path, last=last_obj_in_list)
                _obj_index(
                    b_path, marker, last_obj_in_list, f_list
                )