Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for automagically parsing AWS Lambda EOL runtimes #127

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions src/aws-lambda.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import datetime
import re
from bs4 import BeautifulSoup
from common import endoflife

"""Fetch versions with their dates from the RSS feed of
https://docs.aws.amazon.com/neptune/latest/userguide/engine-releases.html.
"""

PRODUCT = "aws-lambda"
URL = 'https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html'

def parse_date(s):
s = s.strip()
if s == '':
return None
return datetime.datetime.strptime(s, '%b %d, %Y')

print(f"::group::{PRODUCT}")

response = endoflife.fetch_url(URL)
soup = BeautifulSoup(response, features="html5lib")
table_headers = soup.findAll('th', {'class':'table-header'})

runtimes = {}

for table_header in table_headers[0:1]:
print(table_header)
table = table_header.parent.parent.parent
for tr in table.findAll('tr'):
td_list = tr.findAll("td")
if not td_list:
continue
print(td_list)
runtime = td_list[1].find('code').text
r = {
'name': td_list[0].text.strip(),
'deprecation': None,
'endoflife': None,
}
deprecation = td_list[5].text
if deprecation:
r['deprecation'] = parse_date(deprecation)
runtimes[runtime] = r

for table_header in table_headers[1:]:
table = table_header.parent.parent.parent
for tr in table.findAll('tr'):
td_list = tr.findAll("td")
if not td_list:
continue
for td in td_list:
print(td)
runtime = td_list[1].find('code').text
r = {
'name': td_list[0].text.strip(),
'deprecation': parse_date(td_list[3].text),
'endoflife': parse_date(td_list[4].text),
}
runtimes[runtime] = r

print(runtimes)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: store the runtimes and their EOL status