cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We are making some updates so the Community might be down for a few hours on Monday the 11th of November. Apologies for the inconvenience and thank you for your patience. You can find out more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python metadata help

Python metadata help

OGMC
Helpful | Level 6
Go to solution

In V1 as metadata was returned in a dictionary all i had to do was myMeta.get("name") to get the name of an item for examle.

 

Whats the best way to get direct info in V2

 

 

Do i have to regex the metadata object to get name or content hash or is there better way?        

 

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

I'm glad to hear you sorted this out already. Yes, you can directly access those fields like that, no regex necessary.

 

For anyone else looking for this, here's that sample cleaned up:

 

import dropbox

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

myDir = dbx.files_list_folder("")
for item in myDir.entries:
    if isinstance(item, dropbox.files.FileMetadata):
        name = item.name
        fileID = item.id
        fileHash = item.content_hash
        print(name, fileID, fileHash)

View solution in original post

2 Replies 2

OGMC
Helpful | Level 6
Go to solution

ok i think i sussed this.

 

so if i was was to do

 

 

myDir = dbx.files_list_folder()
for item in myDir:
    if isinstance(item, dropbox.filemetadata):
        name = item.name
        fileID = item.id
        fileHash = item.content_hash

 

etc etc

Greg-DB
Dropbox Staff
Go to solution

I'm glad to hear you sorted this out already. Yes, you can directly access those fields like that, no regex necessary.

 

For anyone else looking for this, here's that sample cleaned up:

 

import dropbox

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

myDir = dbx.files_list_folder("")
for item in myDir.entries:
    if isinstance(item, dropbox.files.FileMetadata):
        name = item.name
        fileID = item.id
        fileHash = item.content_hash
        print(name, fileID, fileHash)
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    OGMC Helpful | Level 6
What do Dropbox user levels mean?