Split endoflife.date and releasedata models in separate files (#276)

This makes the code easier to read.
This commit is contained in:
Marc Wrobel
2024-01-07 20:22:46 +01:00
committed by GitHub
parent d01d8ed04b
commit b339c81ead
45 changed files with 190 additions and 185 deletions

View File

@@ -1,6 +1,6 @@
import sys
from common import dates, endoflife, http
from common import dates, endoflife, http, releasedata
"""Fetches releases from the Docker Hub API.
@@ -9,7 +9,7 @@ Unfortunately images creation date cannot be retrieved, so we had to use the tag
METHOD = "docker_hub"
def fetch_releases(p: endoflife.Product, c: endoflife.AutoConfig, url: str) -> None:
def fetch_releases(p: releasedata.Product, c: endoflife.AutoConfig, url: str) -> None:
data = http.fetch_url(url).json()
for result in data["results"]:
@@ -24,7 +24,7 @@ def fetch_releases(p: endoflife.Product, c: endoflife.AutoConfig, url: str) -> N
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
for product_name in endoflife.list_products(METHOD, p_filter):
product = endoflife.Product(product_name)
product = releasedata.Product(product_name)
product_frontmatter = endoflife.ProductFrontmatter(product.name)
for config in product_frontmatter.get_auto_configs(METHOD):
fetch_releases(product, config, f"https://hub.docker.com/v2/repositories/{config.url}/tags?page_size=100&page=1")