We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

venkate's avatar
venkate
Explorer | Level 3
4 years ago

file list from shared folder dropbox rest api python

I need to create a data frame out of attributes and share URL of all the files in a directory and its sub-directories

the code am using is 

for entry in dbx.files_list_folder('/2.info_copy',recursive=True).entries:
  if(str(type(dbx.files_get_metadata(entry.path_lower))) == "<class 'dropbox.files.FileMetadata'>"😞
      shared_link_metadata = dbx.sharing_create_shared_link(entry.path_lower)
      d.append(
        {
            'Name': entry.name,
            'Folder Path': entry.path_lower,
            'Link': shared_link_metadata.url,
            'client_modified' : str(entry.client_modified),
            'server_modified' : str(entry.server_modified),
            'size' : entry.size,
            'content_hash' : entry.content_hash

        })


df = pd.DataFrame(d)
 
I am new to the dropbox API and not sure if can get the list of files from the shared folder.

 

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    You can use the API to list the files in any folder in the connected account, whether or not the folder is shared. I recommend reading the File Access Guide and Team Files Guide for reference.

     

    Looking at your code, there are a few things to note:

     

    • sakoht's avatar
      sakoht
      Explorer | Level 3

      It would be really great to see the snip of code that actually accomplishes what the OP describes above.  Pointing to the manual is way less helpful, as it spends a bunch of time on abstractions.  Please just show the code?   You have to do DropboxTeam() instead of Dropbox().  The methods are different.  Listing things gives back an object that isn't iterable, doesn't seem to contain a list.  This may be obvious to someone ...but not to someone who didn't write it.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 12 months ago
325 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!