Created
September 2, 2013 14:26
-
-
Save khanlou/6413418 to your computer and use it in GitHub Desktop.
This is a simple python script for downloading all of the files in your cloud app. Caveats: "bookmarks" can't be downloaded, so they'll be outputted in the log. All files will be downloaded into the same directory as the python script. It requires pycloudapp, which you can find here: https://github.com/originell/pycloudapp.
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
# requires https://github.com/originell/pycloudapp | |
from cloudapp.cloud import Cloud | |
import urllib | |
mycloud = Cloud() | |
mycloud.auth("username", "password") | |
current_page = 1 | |
total_count = 0; | |
while True: | |
items = mycloud.list_items(page=current_page, per_page=20) | |
for item in items: | |
try: | |
urllib.urlretrieve(item["content_url"], item["name"]) | |
except: | |
print item["content_url"] | |
total_count += len(items) | |
print current_page | |
current_page += 1 | |
if len(items) != 20: | |
break | |
print "done" | |
print total_count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment