Skip to content

Instantly share code, notes, and snippets.

@dmitry-mukhin
Created September 14, 2015 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitry-mukhin/cc57d01e8924c45d56f1 to your computer and use it in GitHub Desktop.
Save dmitry-mukhin/cc57d01e8924c45d56f1 to your computer and use it in GitHub Desktop.
# installation:
# pip install pyuploadcare==1.3.1
from pyuploadcare import conf
from pyuploadcare.api_resources import FileList
import requests
conf.pub_key = 'demopublickey'
conf.secret = 'demoprivatekey'
conf.cdn_base = 'http://ucarecdn.com/'
session = requests.session()
if __name__ == '__main__':
for f in FileList(stored=True, request_limit=500):
print 'fetching {}...'.format(f.uuid)
try:
with open(u'{}.{}'.format(f.uuid, f.filename()), 'wb') as out:
out.write(session.get(f.cdn_url).content)
except ValueError:
pass # do something more useful here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment