Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch all the repositories #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docker_registry_client/_BaseClient.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from requests import get, put, delete
from requests import get, put, delete, utils
from requests.exceptions import HTTPError
import json
from .AuthorizationService import AuthorizationService
Expand Down Expand Up @@ -173,7 +173,19 @@ def check_status(self):

def catalog(self):
self.auth.desired_scope = 'registry:catalog:*'
return self._http_call('/v2/_catalog', get)
data = {'repositories': []}
url = '/v2/_catalog'
while True:
response = self._http_response(url, get)
content = response.json()
if content:
data['repositories'].extend(content[r'repositories'])
if 'Link' in response.headers:
Link = utils.parse_header_links(response.headers['Link'])
url = Link[0]['url']
else:
break
return data

def get_repository_tags(self, name):
self.auth.desired_scope = 'repository:%s:*' % name
Expand Down