cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right 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: 

API Cannot Find Any Files

API Cannot Find Any Files

soubriquet
New member | Level 2

I'm just starting out with the Dropbox API and am trying to just see all my files that I had manually uploaded to my account. I enabled all permissions for my access token just to be sure. However, my script below shows that my account is empty. But there are several files uploaded when I view the web ui. Here is my script. Could someone please point me in the right direction?

 

 

import dropbox

# Initialize a Dropbox client instance
dbx = dropbox.Dropbox('ACCESS_TOKEN')
acct = dbx.users_get_current_account()

def list_files(path=''):
    try:
        result = dbx.files_list_folder(path)
        print(result)
        for entry in result.entries:
            print(entry)
            if isinstance(entry, dropbox.files.FileMetadata):
                share_link = dbx.sharing_create_shared_link_with_settings(entry.path_lower).url
                print(f'{entry.name}: {share_link}')
            elif isinstance(entry, dropbox.files.FolderMetadata):
                list_files(entry.path_lower)  # Recursive call for folders
    except Exception as e:
        print(f'Exception: {e}')

# Call the function to list files and get share links
path = '/production'
list_files(path)

 

 

 

1 Reply 1

Здравко
Legendary | Level 20

@soubriquet wrote:

I'm just starting out with the Dropbox API and am trying to just see all my files that I had manually uploaded to my account. ...

...
# Call the function to list files and get share links
path = '/production'
list_files(path)

Hi @soubriquet,

Hm...🤔 Are "all your files" stored in "production" folder? 🧐

If so, you didn't mention any error output encountered or account type in use (some account types may have different roots). If you are still in confusion, post a screenshot of browser view showing uploaded files you're talking about and the full output of your code. Dump also the content of 'acct' (while hiding the personal information).

Hope this gives direction.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?