How to access files in shared box folder via Python Box SDK
I have been shared a Box folder via the following link:
https://asmodeeuk.app.box.com/v/HobbyOrder
I would like to programatically access these files in python or at least download them locally.
I have set up a developer box account and I am just using the developer token for now.
TOKEN = 'DEV_TOKEN'
auth = OAuth2(None, None, access_token=TOKEN)
box = Client(auth)
I have also added this to my favourites in Box.
favourites_id = 8166214818
items = box.collection(collection_id=favourites_id).get_items()
for item in items:
print(item.id)
I can use the above code to see that the folder is in my favourites collection
{'etag': '0',
'id': '20105505368',
'name': 'Asmodee Box',
'sequence_id': '0',
'type': 'web_link',
'url': 'https://asmodeeuk.app.box.com/v/HobbyOrder'}
However I cannot figure out how to use the above to open the folder and list / download the items within.
Can anyone help with this next step? :)
-
Hi
You can use this API https://developer.box.com/guides/shared-links/find-for-item/ to get the ID of a shared item you have access to.
If you already have the ID like you show above you can simply use the ID to get the folder items with this API https://developer.box.com/reference/get-folders-id-items/
Rgds,
Peter Christensen, Platform Solutions Engineer, Box
Post is closed for comments.
Comments
1 comment