Faraz Mazhar
Faraz Mazhar

Reputation: 89

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.

Upvotes: 6

Views: 12356

Answers (1)

Greg
Greg

Reputation: 16930

[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))

Upvotes: 14

Related Questions