snapcrack
snapcrack

Reputation: 1811

Downloading Dropbox folder with curl/requests

I'm storing two files in a folder on Dropbox and I want to download the folder as a zipped file using requests, just as I would if I were downloading it from Dropbox's GUI. I've created a Share Link and am trying to reach it with requests:

requests.get('https://dl.dropboxusercontent.com/s/folderkeyasdsadlksad?dl=1')

But I get a Response <404>, presumably because I'm trying to access a folder, which has no file extension, rather than a file. How do I download the zipped file?

Upvotes: 0

Views: 1607

Answers (1)

Greg
Greg

Reputation: 16930

Modifying Dropbox shared links to use the dl.dropboxusercontent.com host is not officially supported.

If you want to download from shared links programmatically like this, you can use the www.dropbox.com host with the URL parameters documented here.

For example, that would look like this:

requests.get('https://www.dropbox.com/s/folderkeyasdsadlksad?dl=1')

For links to folders, that will yield a zip download of the folder, after the redirect(s).

Upvotes: 1

Related Questions