[amazon-neptune] Update script to rely on documentation (#519)

Use https://docs.aws.amazon.com/neptune/latest/userguide/toc-contents.json instead of https://docs.aws.amazon.com/neptune/latest/userguide/rssupdates.rss for automation, as it contains a longer versions history.
This commit is contained in:
Marc Wrobel
2025-09-14 18:42:28 +02:00
committed by GitHub
parent ea6214db3c
commit a842011cf8

View File

@@ -1,23 +1,26 @@
import logging
import re
from common import dates, http
from common.releasedata import ProductData, config_from_argv
"""Fetches Amazon Neptune versions from its RSS feed on docs.aws.amazon.com."""
REGEX = r"(Maintenance r|R)elease:? (?P<version>.+) \((?P<date>\d+-\d+-\d+)\)"
def parse(data: dict, product: ProductData) -> None:
if "title" in data:
title = data["title"]
print(title)
match = re.search(REGEX, title)
if match:
name = match.group("version")
date = dates.parse_date(match.group("date"))
product.declare_version(name, date)
for item in data.get("contents", []):
parse(item, product)
config = config_from_argv()
with ProductData(config.product) as product_data:
rss = http.fetch_xml(config.url)
for entry in rss.getElementsByTagName("item"):
version_str = entry.getElementsByTagName("title")[0].firstChild.nodeValue
date_str = entry.getElementsByTagName("pubDate")[0].firstChild.nodeValue
version_match = config.first_match(version_str)
if not version_match:
logging.warning(f"Skipping entry with malformed version: {version_str}")
continue
version = config.render(version_match)
date = dates.parse_datetime(date_str)
product_data.declare_version(version, date)
json = http.fetch_json(config.url)
parse(json, product_data)