Created
April 16, 2020 00:45
-
-
Save justinTM/bf48484f372c51778212a1de33be460e to your computer and use it in GitHub Desktop.
Using Python (`boxsdk`, `requests`, and `tqdm` modules), all files from a Box folder -- specified by ID -- are downloaded via URL. Yes the binary can simply be downloaded with the Box SDK methods.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from boxsdk import DevelopmentClient | |
import requests | |
from tqdm.auto import trange | |
client = DevelopmentClient() | |
user = client.user().get() | |
folder = client.folder(folder_id='XXXXXXXXXXXX') | |
files = [item for item in folder.get_items()] | |
print('Beginning file download with requests...') | |
for i in trange(len(files)): | |
url = files[i].get_download_url() | |
r = requests.get(url) | |
with open('../../Folder/'+item.name, 'wb') as f: | |
f.write(r.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment