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'))
|
||||
|
||||
self.bus.post(Covid19UpdateEvent(
|
||||
country=summary['CountryCode'],
|
||||
country=summary['Country'],
|
||||
country_code=summary['CountryCode'],
|
||||
confirmed=summary['TotalConfirmed'],
|
||||
deaths=summary['TotalDeaths'],
|
||||
recovered=summary['TotalRecovered'],
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue