We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

fapb88ve's avatar
fapb88ve
Explorer | Level 4
9 years ago
Solved

Python API V2 Metadata of root folder

Hello,

 

I see here that the previous version of the API had a way to check for the metadata of the root folder, but it seems that for this version of the API it is not supported. Is there anyway in particular that I could access that in the root folder? Thank you.

3 Replies

  • fapb88ve's avatar
    fapb88ve
    Explorer | Level 4
    9 years ago

    Thanks, Greg. That solved it. One last question: I'm using the funciton you mentioned as follows:

    'client.files_list_folder('').entries' ; it yields a FileMetadata response with the files' properties. Having that said, I noticed in the tutorial that you could pull the name of each file, but I'm also interested in pulling the size as well. I'm trying the following:

     

     

    for i in client.files_list_folder("").entries:
        print(i.size)

     

    But it's not working out. To me it's weird because I'm able to pull out the name property much in the same way. I'm not sure what's exactly wrong.

     

    Sorry if this is a basic question, I'm starting out with python and the Dropbox API.

     

    Thank you,

     

     

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    The ListFolderResult.entries array contains Metadata objects. These can represent files, folders, or deleted items.  The entry would be a FileMetadata, FolderMetadata, or DeletedMetadata, respectively. These are all subclasses of Metadata, but size is only available on FileMetadata.

     

    So, you should do something like this:

     

    for entry in client.files_list_folder("").entries:
        print(entry.name)
        if isinstance(entry, dropbox.files.FileMetadata):
            print(entry.size)

     

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 6 hours ago
410 Following

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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!