in support/retro_contest/rest.py [0:0]
def docker_list_args(args, server, cookies):
r = requests.get(server + '/rest/user', cookies=cookies)
if r.status_code != 200 or 'cr' not in r.json():
print('Failed to obtain container registry')
return False
cr = r.json()['cr']
auth = HTTPBasicAuth(cr['username'], cr['password'])
r = requests.get('https://%s/v2/_catalog' % cr['url'], auth=auth)
repos = r.json()['repositories']
everything = {}
for repo in repos:
r = requests.get('https://%s/v2/%s/tags/list' % (cr['url'], repo), auth=auth)
if r.status_code != 200:
continue
try:
info = r.json()
everything[repo] = info.get('tags')
except:
pass
for k, v in everything.items():
print(k + ':')
for tag in v:
print(' ' + tag)
return True