Skip to main content
Question

Error While reading files from a box folder using JWT method in python

  • May 22, 2025
  • 1 reply
  • 18 views

Forum|alt.badge.img

Hi, 

 

Below code for reading files from the box folder was working for me giving me a list of all the files with their file ID

 

items = client.folder(folder_id='folder_id').get_items(limit=100, offset=0)

But now when i am running the same code it shows me

 

Can i know the issue and the changes i should make in order to get the result i was getting earlier.

 

Thanks 

1 reply

Forum|alt.badge.img

 The behavior of this method changed in v2.0.0 of the Python SDK — it now returns an iterator that will automatically get all the items in the folder for you if you iterate over it.  If you just want a list of the first 100 items in the folder, you can simply read them out of the iterator that you get back from that method.  Something like this should work for you:

 

items_iter = client.folder(folder_id='folder_id').get_items(limit=100, offset=0)

items = []
for x in range(100):
    items.append(items_iter.next())