Python package to get information regarding the novel corona virus provided by Johns Hopkins university and worldometers.info
Full Documentation can be found here
python >= 3.6
pip install covid
pydantic
requests
```python from covid import Covid
covid = Covid() covid.get_data() ```
python
[
{
'id': '53',
'country': 'China',
'confirmed': 81020,
'active': 9960,
'deaths': 3217,
'recovered': 67843,
'latitude': 30.5928,
'longitude': 114.3055,
'last_update': 1584097775000
},
{
'id': '115',
'country': 'Italy',
'confirmed': 24747,
'active': 20603,
'deaths': 1809,
'recovered': 2335,
'latitude': 41.8719,
'longitude': 12.5674,
'last_update': 1584318130000
},
...
]
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.
python
countries = covid.list_countries()
python
[
{'id': '53', 'country': 'China'},
{'id': '115', 'country': 'Italy'}
...
]
python
italy_cases = covid.get_status_by_country_id(115)
python
{
'id': '115',
'country': 'Italy',
'confirmed': 24747,
'active': 20603,
'deaths': 1809,
'recovered': 2335,
'latitude': 41.8719,
'longitude': 12.5674,
'last_update': 1584318130000
}
python
italy_cases = covid.get_status_by_country_name("italy")
python
{
'id': '115',
'country': 'Italy',
'confirmed': 24747,
'active': 20603,
'deaths': 1809,
'recovered': 2335,
'latitude': 41.8719,
'longitude': 12.5674,
'last_update': 1584318130000
}
python
confirmed = covid.get_total_confirmed_cases()
python
deaths = covid.get_total_deaths()
python
covid = Covid(source="worldometers")
python
covid.get_data()
```python [ { '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') } ... ]
```
python
covid.get_status_by_country_name("italy")
python
{
'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')
}
python
countries = covid.list_countries()
python
[
'china',
'italy',
'usa',
'spain',
'germany',
...
]
python
active = covid.get_total_active_cases()
python
confirmed = covid.get_total_confirmed_cases()
python
recovered = covid.get_total_recovered()
python
deaths = covid.get_total_deaths()
bash
covid --help
bash
covid
or
bash
covid -s john_hopkins
bash
covid -s worldometers
This comes in handy when you need to know the available names of countries
when using covid -s 'source' -c '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.
bash
covid -s worldometers --list-countries
bash
covid -s worldometers -c sweden
bash
covid -s worldometers -o active
bash
covid -s worldometers -o confirmed
bash
covid -s worldometers -o recovered
bash
covid -s worldometers -o deaths
Bumps certifi from 2021.10.8 to 2022.12.7.
9e9e840
2022.12.07b81bdb2
2022.09.24939a28f
2022.09.14aca828a
2022.06.15.2de0eae1
Only use importlib.resources's new files() / Traversable API on Python ≥3.11 ...b8eb5e9
2022.06.15.147fb7ab
Fix deprecation warning on Python 3.11 (#199)b0b48e0
fixes #198 -- update link in license9d514b4
2022.06.154151e88
Add py.typed to MANIFEST.in to package in sdist (#196)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Bumps ipython from 7.28.0 to 7.31.1.
e321e76
release 7.31.167ca2b3
Merge pull request from GHSA-pq7m-3gw7-gq5x2794330
back to devbe343e7
release 7.31.00fcf2c4
Merge pull request #13428 from meeseeksmachine/auto-backport-of-pr-13427-on-7.xb8db9b1
Backport PR #13427: wn 7317f253dc
Merge pull request #13412 from bnavigator/backport-inspect4f26796
fix xxlimited_35 import name77ca4a6
don't run nose-based iptest on py310, only pytest533e509
back to decorator skipDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
bugfix allow None values
recovered
attribute None valuesI am an IT veteran with focus on software development for web applications
GitHub Repository Homepagecovid-19 covid-virus coronavirus covid covid-2019 covid-api python python36