Dropbox Core API list all folders

我的未来我决定 提交于 2019-12-10 15:45:29

问题


So I have been playing with Dropbox APIs for awhile. My app is retrieving all the image files from a user's dropbox via Core API.

Now I want to improve it a bit by allowing users to choose which folder to sync.. i.e. once they authorise the app, it will give them all the folders inside their account. Users can then choose one or many folder(s), the app will only retrieve image files from selected folders.

Is there a specific API that list out all folders inside a user's dropbox?

I'm not using any SDK.


回答1:


Using the https://api.dropbox.com/1/metadata/dropbox/<path> gives you the details of the contents of directory

import requests
...
headers = ... # set up auth
...
params = { 'list' : 'true' }
response = requests.get('https://api.dropbox.com/1/metadata/dropbox/<directory>', params=params, headers=headers)
subdirs = [d['path'] for d in response.json()['contents'] if d['is_dir'] == True]    
print(subdirs)


来源:https://stackoverflow.com/questions/18821637/dropbox-core-api-list-all-folders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!