WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
This repository was archived by the owner on Nov 19, 2021. It is now read-only.

Commit 8abaafa

Browse files
committed
Total row changed too
1 parent 28cf9a9 commit 8abaafa

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

custom_components/coronavirus_hessen/__init__.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ async def async_get_data():
7373
result = dict()
7474
rows = data.select("article table:first-of-type tr")
7575

76-
# Counties
77-
for row in rows[1:-1]:
76+
for row in rows[1:]:
7877
line = row.select("td")
7978
if len(line) != 3:
8079
continue
@@ -89,14 +88,10 @@ async def async_get_data():
8988
except ValueError:
9089
_LOGGER.error("Error processing line {}, skipping".format(line))
9190
continue
92-
result[county] = cases
9391

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

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

0 commit comments

Comments
 (0)