Skip to content

Commit

Permalink
fix: parsing EBS info
Browse files Browse the repository at this point in the history
  • Loading branch information
EverettBerry committed Dec 30, 2023
1 parent fe5c7b8 commit 9686d57
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def __repr__(self):


def sanitize_instance_type(instance_type):
"""Typos and other bad data are common in the instance type colums for some reason"""
"""Typos and other bad data are common in the instance type columns for some reason"""
# Remove random whitespace
instance_type = re.sub(r"\s+", "", instance_type, flags=re.UNICODE)

Expand Down Expand Up @@ -332,7 +332,9 @@ def parse_ebs_combined_table(by_type, table):
if row.xpath("th"):
continue
cols = row.xpath("td")
instance_type = sanitize_instance_type(totext(cols[0]).replace("*", ""))
# remove last character which is a superscript with other info
instance_type = sanitize_instance_type(totext(cols[0]))[:-1]
print(instance_type)

if len(cols) == 4:
ebs_baseline_bandwidth = locale.atof(totext(cols[1]))
Expand Down Expand Up @@ -366,7 +368,8 @@ def parse_ebs_nondefault_table(by_type, table):
if row.xpath("th"):
continue
cols = row.xpath("td")
instance_type = sanitize_instance_type(totext(cols[0]).replace("*", ""))
# remove last character which is a superscript with other info
instance_type = sanitize_instance_type(totext(cols[0]))[:-1]
ebs_max_bandwidth = locale.atof(totext(cols[1]))
ebs_throughput = locale.atof(totext(cols[2]))
ebs_iops = locale.atof(totext(cols[3]))
Expand Down

0 comments on commit 9686d57

Please sign in to comment.