Skip to content

Not able to use get_directory_contents #10

Description

@jbd

Hello,

I'm trying to list a directory with 718 directories in it using get_directory_content API function, but I can't make it work.

If I don't use a limit option, or if I use a limit option higher than the number of directories I've got, I can't
get anything from the function. AM I misusing something ?

api_response = ns_api.get_directory_contents(options.path) # does not work
print(api_response) # {'children': None, 'resume': None}

api_response = ns_api.get_directory_contents(options.path, limit=8192) # does not work
print(api_response) # {'children': None, 'resume': None}
api_response = ns_api.get_directory_contents(options.path, limit=1) # does work
print(api_response) # print {'children': [{'access_time': None,
                             #  'atime_val': None,
                             # 'block_size': None,
                             # 'blocks': None,

And even with limit=1, I'm not able to resume the listing after with something like that:

api_response = api.get_directory_contents(directory, detail='name,gid', type='container', limit=1)
            
while api_response.resume:
                api_response = api.get_directory_contents(directory, resume=api_response.resume)
                for container in api_response.children:
                        yield container

Here is a usable gist: https://gist.github.com/jbd/8a5f691e75509dc5397243a105dc61fa

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bug_SDKBugs related to SDK and surrounding scripts

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions