5

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.

Faraz Mazhar
  • 79
  • 1
  • 1
  • 10

1 Answers1

13

[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))
Greg
  • 16,359
  • 2
  • 34
  • 44
  • This no longer works, I am getting the following error: ApiError: ApiError('..', ListFolderError('path', LookupError('not_found', None))) – DBa Oct 02 '19 at 11:48
  • 2
    @DBa I just tried it again, and confirmed that the method still works. If you're getting a `not_found` error, that can indicate that you're supplying an incorrect URL and/or path. I see you also posted this on the forum so I'll follow up with you there: https://www.dropboxforum.com/t5/Discuss-Developer-API/Iterating-and-Downloading-from-shared-link-subfolders/m-p/368500#M779 – Greg Oct 02 '19 at 17:40