Skip to content

Instantly share code, notes, and snippets.

@belisarius222
Last active December 21, 2015 06:09
Show Gist options
  • Select an option

  • Save belisarius222/6261980 to your computer and use it in GitHub Desktop.

Select an option

Save belisarius222/6261980 to your computer and use it in GitHub Desktop.
little script to download files sequentially from an S3 bucket. This will download all the mongo binaries into the same directory as the script.
import requests
filenames = [
'doxygenConfig',
'firstExample',
'secondExample',
'SConstruct',
'mongod',
'mongo',
'mongodump',
'mongorestore',
'test',
'perftest',
'mongostat',
'mongofiles',
'mongoimport',
'mongoexport',
'mongooplog',
'mongotop',
'bsondump',
'mongoperf',
'mongos',
'rsExample',
'clientTest',
'tutorial',
'whereExample',
'authTest',
'httpClientTest',
'bsondemo',
'mongo_astyle',
'node'
]
base_url = 'https://bbb-binaries.s3.amazonaws.com'
for filename in filenames:
with open(filename, 'wb') as handle:
url = base_url+'/'+filename
print 'Downloading from: '+url
request = requests.get(url, stream=True)
for block in request.iter_content(1024):
if not block:
break
handle.write(block)
print 'Finished download.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment