Skip to content

Instantly share code, notes, and snippets.

@bgruening
Created January 23, 2017 19:47
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 bgruening/17321f69e35143ffa202d344875a7343 to your computer and use it in GitHub Desktop.
Save bgruening/17321f69e35143ffa202d344875a7343 to your computer and use it in GitHub Desktop.
get all biocontainers via Quay.io API
#!/usr/bin/env python
import argparse
import json
import sys
import tempfile
try:
import requests
except ImportError:
requests = None
QUAY_API_URL = 'https://quay.io/api/v1/repository'
parameters = {'public': 'true', 'namespace': 'biocontainers'}
r = requests.get(QUAY_API_URL, headers={'Accept-encoding': 'gzip'}, params=parameters,
timeout=12)
json_decoder = json.JSONDecoder()
decoded_request = json_decoder.decode(r.text)
for repository in decoded_request['repositories']:
rep_name = repository['name']
url = "%s/%s/%s" % (QUAY_API_URL, 'biocontainers', rep_name)
r = requests.get(url, headers={'Accept-encoding': 'gzip'}, timeout=12)
json_decoder = json.JSONDecoder()
decoded_request = json_decoder.decode(r.text)
for tag, infos in decoded_request['tags'].items():
print('quay.io/biocontainers/%s:%s\t%s' % (rep_name, tag, infos['size']))
# docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /share/:/output --privileged -t --rm dk2sin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment