Created
September 14, 2015 17:38
-
-
Save dmitry-mukhin/cc57d01e8924c45d56f1 to your computer and use it in GitHub Desktop.
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
# 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