fix for file.list api pagination
This commit is contained in:
@ -10,6 +10,7 @@ from mdrsclient.commands.base import BaseCommand
|
||||
from mdrsclient.connection import MDRSConnection
|
||||
from mdrsclient.exceptions import IllegalArgumentException, UnexpectedException
|
||||
from mdrsclient.models import File, Folder, Laboratory
|
||||
from mdrsclient.models.file import find_file
|
||||
from mdrsclient.settings import CONCURRENT
|
||||
|
||||
|
||||
@ -77,7 +78,8 @@ class DownloadCommand(BaseCommand):
|
||||
raise IllegalArgumentException(f"Local directory `{local_path}` not found.")
|
||||
laboratory = cls._find_laboratory(connection, laboratory_name)
|
||||
r_parent_folder = cls._find_folder(connection, laboratory, r_dirname, password)
|
||||
file = r_parent_folder.find_file(r_basename)
|
||||
r_parent_files = cls._find_files(connection, r_parent_folder.id)
|
||||
file = find_file(r_parent_files, r_basename)
|
||||
if file is not None:
|
||||
if cls.__check_excludes(excludes, laboratory, r_parent_folder, file):
|
||||
return
|
||||
@ -109,13 +111,14 @@ class DownloadCommand(BaseCommand):
|
||||
) -> None:
|
||||
context = DownloadContext(False, is_skip_if_exists, [])
|
||||
folder = folder_api.retrieve(folder_id)
|
||||
files = cls._find_files(connection, folder.id)
|
||||
dirname = os.path.join(basedir, folder.name)
|
||||
if cls.__check_excludes(excludes, laboratory, folder, None):
|
||||
return
|
||||
if not os.path.exists(dirname):
|
||||
os.makedirs(dirname)
|
||||
print(dirname)
|
||||
for file in folder.files:
|
||||
for file in files:
|
||||
if cls.__check_excludes(excludes, laboratory, folder, file):
|
||||
continue
|
||||
path = os.path.join(dirname, file.name)
|
||||
|
Reference in New Issue
Block a user