Skip to content

Instantly share code, notes, and snippets.

@minrk
Created October 1, 2024 15:49
Show Gist options
  • Save minrk/ce9351a4db5fda8b893d5ef90da75037 to your computer and use it in GitHub Desktop.
Save minrk/ce9351a4db5fda8b893d5ef90da75037 to your computer and use it in GitHub Desktop.
import requests
def get_tags(repo):
"""Yield all tags for a repo on quay.io
Iterates through paginated requests
"""
next_url = f"https://quay.io/v2/{repo}/tags/list"
while next_url:
r = requests.get(next_url)
r.raise_for_status()
resp = r.json()
yield from resp["tags"]
if "next" in r.links:
next_url = "https://quay.io" + r.links["next"]["url"]
else:
next_url = None
def main():
for tag in get_tags("jupyter/datascience-notebook"):
print(tag)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment