Skip to content

Commit 198e401

Browse files
committed
[conda] fix quayio api listing add pagination use, closes #142
1 parent 34ae607 commit 198e401

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

biocontainers/quayio/models.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,25 @@ def get_containers_list(self):
7070
"""
7171
container_list = []
7272
string_url = self.containers_list_url.replace('%namespace%', self.namespace)
73+
has_next_page = True
74+
next_page_token = None
7375
try:
74-
response = call_api(string_url)
75-
if response.status_code == 200:
76-
json_data = json.loads(response.content.decode('utf-8'))
77-
for key in json_data['repositories']:
78-
container = QuayIOContainer(key)
79-
container_list.append(container)
80-
logger.info("A short description has been retrieved from Quay.io for this container -- " + container.name())
76+
while has_next_page:
77+
next_page = string_url
78+
if next_page_token:
79+
next_page = string_url + '&next_page=' + next_page_token
80+
response = call_api(next_page)
81+
if response.status_code == 200:
82+
json_data = json.loads(response.content.decode('utf-8'))
83+
for key in json_data['repositories']:
84+
container = QuayIOContainer(key)
85+
container_list.append(container)
86+
logger.info("A short description has been retrieved from Quay.io for this container -- " + container.name())
87+
if 'next_page' in json_data:
88+
has_next_page = True
89+
next_page_token = json_data['next_page']
90+
else:
91+
has_next_page = False
8192
except (ConnectionError, NewConnectionError) as error:
8293
logger.error(" Connection has failed to QuaIO for following url --" + string_url)
8394

0 commit comments

Comments
 (0)