Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Commit

Permalink
Total row changed too
Browse files Browse the repository at this point in the history
  • Loading branch information
foosel committed Mar 19, 2020
1 parent 28cf9a9 commit 8abaafa
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions custom_components/coronavirus_hessen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ async def async_get_data():
result = dict()
rows = data.select("article table:first-of-type tr")

# Counties
for row in rows[1:-1]:
for row in rows[1:]:
line = row.select("td")
if len(line) != 3:
continue
Expand All @@ -89,14 +88,10 @@ async def async_get_data():
except ValueError:
_LOGGER.error("Error processing line {}, skipping".format(line))
continue
result[county] = cases

# Total
line = rows[-1].select("td")
try:
result[OPTION_TOTAL] = int(line[-1].select("p strong")[0].text.strip())
except ValueError:
_LOGGER.error("Error processing total value from {}, skipping".format(line))
if county == "Gesamt":
county = OPTION_TOTAL
result[county] = cases

_LOGGER.debug("Corona Hessen: {!r}".format(result))
return result
Expand Down

0 comments on commit 8abaafa

Please sign in to comment.