cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Download a file inside a Shared Team Folder using the Python SDK

Download a file inside a Shared Team Folder using the Python SDK

naru95
New member | Level 2
Go to solution

I'm trying to download files inside a shared Dropbox Team Folder.

 

I have a list of shared folders in my account and I have the preview URLs saved for all the folders.

Using the preview URLs, I am able to recursively get a list of all files within the directory as follows:

 

link = dropbox.files.SharedLink(url=shared)
entries = dbx.files_list_folder(path="", shared_link=link).entries

This works great - it gives me the list of all the files and folders inside. I can recursively run the files_list_folder with the updated path including the entry name as well. However, the path_lower values for all entries are None.

 

 

Next, I need to be able to download the files to my local machine using the SDK.

 

I can use the following for files in my personal/user dropbox account:

dbx.files_download_to_file(tmp, entry.id)

But I'm not able to use that to download files in the shared directry.

 

Instead of entry.id, I tried {path/to/file} and {parent folder id}/{path/to/file} but those doesn't work either.

I also tried using sharing_get_shared_link_file but that returns:

dropbox.exceptions.ApiError: ApiError('489644ba039f4389a501a619df93a11a', GetSharedLinkFileError('shared_link_not_found', None))

Any help would be greatly appreciated!! Thank you so much!

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

I can't say for sure exactly what's happening without seeing the actual values, but if the files are in the connected account, it's better to use paths/IDs everywhere, instead of preview/shared links. That's the more direct way of referencing things and may avoid the missing path values you mentioned, depending on the scenario.

 

Also, note that if the files are in the "team space", you do need to set some additional configuration to be able to access them. (API calls operate in the "team member folder" by default, but you can access the "team space" when you need to.) I recommend reading the Team Files Guide first:

 

https://www.dropbox.com/lp/developers/reference/dbx-team-files-guide

 

In the Python SDK in particular, you can set that 'Dropbox-API-Path-Root' header via Dropbox.with_path_root.

View solution in original post

1 Reply 1

Greg-DB
Dropbox Staff
Go to solution

I can't say for sure exactly what's happening without seeing the actual values, but if the files are in the connected account, it's better to use paths/IDs everywhere, instead of preview/shared links. That's the more direct way of referencing things and may avoid the missing path values you mentioned, depending on the scenario.

 

Also, note that if the files are in the "team space", you do need to set some additional configuration to be able to access them. (API calls operate in the "team member folder" by default, but you can access the "team space" when you need to.) I recommend reading the Team Files Guide first:

 

https://www.dropbox.com/lp/developers/reference/dbx-team-files-guide

 

In the Python SDK in particular, you can set that 'Dropbox-API-Path-Root' header via Dropbox.with_path_root.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?