Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Dropbox API v2 and Python, how to get a list of files and folders present in a publicly shared folder?

I am new to Dropbox API and creating a Python app for a publicly shared link. I want to get a list of files and folders and their modified date present in the said publicly shared link. I am looking for something similar to "files_list_folder" in terms of functionality. Thanks.

like image 512
Faraz Mazhar Avatar asked Dec 24 '22 11:12

Faraz Mazhar


1 Answers

[Cross-linking for reference: https://www.dropboxforum.com/t5/API-support/How-to-get-a-list-of-files-and-folders-present-in-a-publicly/m-p/257852#M14954 ]

You can actually use files_list_folder itself to list the contents of a shared link for a folder. To do so, you should use the shared_link parameter. That would look like this:

import dropbox

dbx = dropbox.Dropbox("<ACCESS_TOKEN>")

url = "https://www.dropbox.com/sh/..."
shared_link = dropbox.files.SharedLink(url=url)

print(dbx.files_list_folder(path="", shared_link=shared_link))
like image 66
Greg Avatar answered Jan 14 '23 14:01

Greg