Use both country and country_code on the event

This commit is contained in:
Fabio Manganiello 2020-05-01 00:03:55 +02:00
parent a387b84623
commit 1d24c878e6
2 changed files with 4 additions and 1 deletions

View file

@ -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'],

View file

@ -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)