forked from platypush/platypush
Use both country and country_code on the event
This commit is contained in:
parent
a387b84623
commit
1d24c878e6
2 changed files with 4 additions and 1 deletions
|
@ -70,7 +70,8 @@ class Covid19Backend(Backend):
|
||||||
update_time = datetime.datetime.fromisoformat(summary['Date'].replace('Z', '+00:00'))
|
update_time = datetime.datetime.fromisoformat(summary['Date'].replace('Z', '+00:00'))
|
||||||
|
|
||||||
self.bus.post(Covid19UpdateEvent(
|
self.bus.post(Covid19UpdateEvent(
|
||||||
country=summary['CountryCode'],
|
country=summary['Country'],
|
||||||
|
country_code=summary['CountryCode'],
|
||||||
confirmed=summary['TotalConfirmed'],
|
confirmed=summary['TotalConfirmed'],
|
||||||
deaths=summary['TotalDeaths'],
|
deaths=summary['TotalDeaths'],
|
||||||
recovered=summary['TotalRecovered'],
|
recovered=summary['TotalRecovered'],
|
||||||
|
|
|
@ -10,6 +10,7 @@ class Covid19UpdateEvent(Event):
|
||||||
deaths: int,
|
deaths: int,
|
||||||
recovered: int,
|
recovered: int,
|
||||||
country: Optional[str] = None,
|
country: Optional[str] = None,
|
||||||
|
country_code: Optional[str] = None,
|
||||||
update_time: Optional[datetime] = None,
|
update_time: Optional[datetime] = None,
|
||||||
*args, **kwargs):
|
*args, **kwargs):
|
||||||
super().__init__(*args,
|
super().__init__(*args,
|
||||||
|
@ -17,6 +18,7 @@ class Covid19UpdateEvent(Event):
|
||||||
deaths=deaths,
|
deaths=deaths,
|
||||||
recovered=recovered,
|
recovered=recovered,
|
||||||
country=country,
|
country=country,
|
||||||
|
country_code=country_code,
|
||||||
update_time=update_time,
|
update_time=update_time,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue