Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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
You can’t perform that action at this time.