This way the writing of the JSON file is handled automatically if the update does not fail. It pave the way to further global improvements, such as a better error handling.
16 lines
700 B
Python
16 lines
700 B
Python
from common import dates, releasedata
|
|
from requests_html import HTMLSession
|
|
|
|
"""Fetches Confluence versions from www.atlassian.com.
|
|
|
|
Note that requests_html is used because JavaScript is needed to render the page."""
|
|
|
|
with releasedata.ProductData("confluence") as product_data:
|
|
r = HTMLSession().get("https://www.atlassian.com/software/confluence/download-archives")
|
|
r.html.render(sleep=1, scrolldown=3)
|
|
|
|
for version_block in r.html.find('.versions-list'):
|
|
version = version_block.find('a.product-versions', first=True).attrs['data-version']
|
|
date = dates.parse_date(version_block.find('.release-date', first=True).text)
|
|
product_data.declare_version(version, date)
|