Worldometers.info
by default Covid
uses worldometers.info as default
so you can use:
from covid import covid
# by default data source is "worldometers"
covid = Covid()
# or
covid = Covid(source="worldometers")
Check the Source
covid.source
result
"worldometers"
Get Data
covid.get_data()
result
[
{
'country': 'USA',
'confirmed': 311637,
'new_cases': 280,
'deaths': 8454,
'recovered': 14828,
'active': 288355,
'critical': 8206,
'new_deaths': 2,
'total_tests': 1656897,
'total_tests_per_million': Decimal('0'),
'total_cases_per_million': Decimal('941'),
'total_deaths_per_million': Decimal('26')
},
{
'active': 1376,
'confirmed': 81669,
'country': 'China',
'critical': 295,
'deaths': 3329,
'new_cases': 30,
'new_deaths': 3,
'recovered': 76964,
'total_cases_per_million': Decimal('57'),
'total_deaths_per_million': Decimal('2'),
'total_tests': 0,
'total_tests_per_million': Decimal('0')
}
...
]
Get Status By Country Name
covid.get_status_by_country_name("italy")
result
{
'active': 88274,
'confirmed': 124632,
'country': 'Italy',
'critical': 3994,
'deaths': 15362,
'new_cases': 0,
'new_deaths': 0,
'recovered': 20996,
'total_cases_per_million': Decimal('2061'),
'total_deaths_per_million': Decimal('254'),
'total_tests': 657224,
'total_tests_per_million': Decimal('0')
}
List Countries
This comes in handy when you need to know the available names of countries
when using get_status_by_country_name
, eg. "The Republic of Moldova" or just "Moldova"
So use this when you need to know the country exact name that you can use.
countries = covid.list_countries()
result
[
'china',
'italy',
'usa',
'spain',
'germany',
...
]
Get Total Active cases
active = covid.get_total_active_cases()
Get Total Confirmed cases
confirmed = covid.get_total_confirmed_cases()
Get Total Recovered cases
recovered = covid.get_total_recovered()
Get Total Deaths
deaths = covid.get_total_deaths()