Suddenly Slowness with Python SDK

Hi,

We’ve been using the Python SDK to run a nightly job that gives us a list of all the files (and some metadata) in our account.

That job historically took about 30 minutes to complete, recursively going through all the directories, etc. As of a few days ago (11/5), though, it suddenly doubled in length, even though the number of files/folders in our account hadn’t changed.

So two questions:

  1. Has anyone else noticed anything similar over the last few days?
  2. Is there a better/different way to get to that data?

Our current function looks something like this:

def get_recursive_files(settings, client, folder_id, path_prefix=None):
    file_list = []
    folder = client.folder(folder_id).get()
    for item in folder.get_items():
        if item.type == 'folder':
            file_list += get_recursive_files(settings, client, item.id, path_prefix)
        else:
            file = item.get(fields=['id', 'name', 'created_by', 'created_at', 'modified_by', 'modified_at', 'path_collection', 'version_number'])
            file_path = '/'.join([e.name for e in file.path_collection['entries']])

            if path_prefix is not None:
                if file_path.startswith(path_prefix):
                    file_path = file_path[len(path_prefix):]

                if file_path.startswith('/'):
                    file_path = file_path[1:]

            created_by = f'{file.created_by.name} <{file.created_by.login}>' if file.created_by.name != "Anonymous User" else f'{file.created_by.name}'
            modified_by = f'{file.modified_by.name} <{file.modified_by.login}>' if file.modified_by.name != "Anonymous User" else f'{file.modified_by.name}'

            f_dict = {
                'id': file.id,
                'name': file.name, 
                'created_by': created_by,
                'created_at': file.created_at, 
                'modified_by': modified_by,
                'modified_at': file.modified_at, 
                'file_path': file_path,
                'url': f'/file/{file.id}',
                'version_number': file.version_number,
                'folder_id': folder_id
                }
            file_list.append(f_dict)

    return file_list

Hi Justin (@user120), welcome to the forum.

This is interesting.

Last week there were a few issues reported with Box.

I’m wondering if this situation is consistent, let us know if so, one way or the other.

In the mean time, I’ll convert this into a support case, so the IT folks can follow up with you.

Best regards