From 1d24c878e66a8df8f0ae1286877715fb90bf3284 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 1 May 2020 00:03:55 +0200 Subject: [PATCH] Use both country and country_code on the event --- platypush/backend/covid19.py | 3 ++- platypush/message/event/covid19.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/platypush/backend/covid19.py b/platypush/backend/covid19.py index f1fa96798..598f10871 100644 --- a/platypush/backend/covid19.py +++ b/platypush/backend/covid19.py @@ -70,7 +70,8 @@ class Covid19Backend(Backend): update_time = datetime.datetime.fromisoformat(summary['Date'].replace('Z', '+00:00')) self.bus.post(Covid19UpdateEvent( - country=summary['CountryCode'], + country=summary['Country'], + country_code=summary['CountryCode'], confirmed=summary['TotalConfirmed'], deaths=summary['TotalDeaths'], recovered=summary['TotalRecovered'], diff --git a/platypush/message/event/covid19.py b/platypush/message/event/covid19.py index 9e21ac9be..849efa59b 100644 --- a/platypush/message/event/covid19.py +++ b/platypush/message/event/covid19.py @@ -10,6 +10,7 @@ class Covid19UpdateEvent(Event): deaths: int, recovered: int, country: Optional[str] = None, + country_code: Optional[str] = None, update_time: Optional[datetime] = None, *args, **kwargs): super().__init__(*args, @@ -17,6 +18,7 @@ class Covid19UpdateEvent(Event): deaths=deaths, recovered=recovered, country=country, + country_code=country_code, update_time=update_time, **kwargs)