Improve HTTP handling in scripts (#449)
Provide some helper methods to hide the complexity of parsing HTML, JSON, YAML, XML or Markdown.
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
import logging
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from common import dates, endoflife, http, releasedata
|
||||
|
||||
"""Fetches NetBSD versions and EOL information from https://www.netbsd.org/."""
|
||||
|
||||
for config in endoflife.list_configs_from_argv():
|
||||
with releasedata.ProductData(config.product) as product_data:
|
||||
response = http.fetch_url(config.url)
|
||||
soup = BeautifulSoup(response.text, features="html5lib")
|
||||
html = http.fetch_html(config.url)
|
||||
|
||||
for row in soup.select('table tbody tr'):
|
||||
for row in html.select('table tbody tr'):
|
||||
cells = [cell.get_text(strip=True) for cell in row.select('td')]
|
||||
|
||||
version = cells[0]
|
||||
|
||||
Reference in New Issue
Block a user