Align custom scripts with generic scripts, making them configurable. This has a few advantages: - script code is more unified, - no more hard-coded method names in scripts, which is less error prone and make it easier to rename scripts, - no more hard coded product names in scripts, which is less error prone and make it easier to rename products, - less hard-coded URLs and regexes in scripts, which makes auto-configuration more expressive / updatable, Also added method `endoflife.list_configs_from_argv()` so that it is easier to manipulate scripts arguments.
19 lines
860 B
Python
19 lines
860 B
Python
from bs4 import BeautifulSoup
|
|
from common import dates, endoflife, http, releasedata
|
|
|
|
"""Fetches versions from Atlassian download-archives pages.
|
|
|
|
This script takes a single argument which is the url of the product's download-archives URL, such as
|
|
`https://www.atlassian.com/software/confluence/download-archives`.
|
|
"""
|
|
|
|
for config in endoflife.list_configs_from_argv():
|
|
with releasedata.ProductData(config.product) as product_data:
|
|
content = http.fetch_javascript_url(config.url, wait_until='networkidle')
|
|
soup = BeautifulSoup(content, 'html5lib')
|
|
|
|
for version_block in soup.select('.versions-list'):
|
|
version = version_block.select_one('a.product-versions').attrs['data-version']
|
|
date = dates.parse_date(version_block.select_one('.release-date').text)
|
|
product_data.declare_version(version, date)
|