Passing the `skip` parameter, or any other, to `ListAndSearchFileRequestOptions` does not make any difference
Closed this issue · 4 comments
Hello,
I'm trying to get a list of all the images I have uploaded. There are more then 1k so the way I used to do this is by calling imagekit.list_files
multiple times passing an increasing skip
parameter till I'm done. This is no longer working in the latest version of the SDK.
I updated my code to use ListAndSearchFileRequestOptions
but still does not work.
options = ListAndSearchFileRequestOptions(skip=0)
all_images = imagekit.list_files(options=options).list
all_images[0].name
Out[88]: '11949_1_WngYbAgnF.jpg'
In [90]: all_images[999].name
Out[90]: '58618_9_RA-33Vrng.jpg'
Now trying to skip some images, same result, no matter what I pass on skip
options = ListAndSearchFileRequestOptions(skip=1000)
all_images = imagekit.list_files(options=options).list
all_images[0].name
Out[88]: '11949_1_WngYbAgnF.jpg'
In [90]: all_images[999].name
Out[90]: '58618_9_RA-33Vrng.jpg'
Now trying to get just a set of images. It seems no matter what I pass in options nothing happens.
In [92]: options = ListAndSearchFileRequestOptions(limit=10)
...: all_images = imagekit.list_files(options=options).list
...: len(all_images)
Out[92]: 1000
Even when I copy the example in readme.md
, nothing different happens
In [18]: options = ListAndSearchFileRequestOptions(
...: type='file',
...: sort='ASC_CREATED',
...: path='/',
...: search_query="created_at >= '2d' OR size < '2mb' OR format='png'",
...: file_type='all',
...: limit=5,
...: skip=0,
...: tags='Software, Developer, Engineer',
...: )
...:
...: result = imagekit.list_files(options=options)
In [19]: len(result.list)
Out[19]: 1000
Curl does work, I used this website https://curlconverter.com/ to translate the crul request into python requests, and I was able to skip. In case someone that comes here wants a work around 😄
The SDK should still be reviewed
This will be fixed soon. The PR is already in review.
Fixed in version 3.0.1