Python package to fetch information regarding the novel corona virus provided by Johns Hopkins university and worldometers.info

nf1s, updated 🕥 2022-12-08 12:40:57

Covid

CircleCI codecov GitHub Pipenv locked Python version Downloads GitHub

Description

Python package to get information regarding the novel corona virus provided by Johns Hopkins university and worldometers.info

Full Documentation can be found here

corona.jpeg

Requirements

python >= 3.6

How to install

pip install covid

Dependencies

pydantic
requests

How to use

John Hopkins University API

john_hopkins

Get All Data

```python from covid import Covid

covid = Covid() covid.get_data() ```

Result

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 }, ... ]

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.

python countries = covid.list_countries()

Result

python [ {'id': '53', 'country': 'China'}, {'id': '115', 'country': 'Italy'} ... ]

Get Status By Country ID

python italy_cases = covid.get_status_by_country_id(115)

Result

python { 'id': '115', 'country': 'Italy', 'confirmed': 24747, 'active': 20603, 'deaths': 1809, 'recovered': 2335, 'latitude': 41.8719, 'longitude': 12.5674, 'last_update': 1584318130000 }

Get Status By Country Name

python italy_cases = covid.get_status_by_country_name("italy")

Result

python { 'id': '115', 'country': 'Italy', 'confirmed': 24747, 'active': 20603, 'deaths': 1809, 'recovered': 2335, 'latitude': 41.8719, 'longitude': 12.5674, 'last_update': 1584318130000 }

Get Total Confirmed cases

python confirmed = covid.get_total_confirmed_cases()

Get Total Deaths

python deaths = covid.get_total_deaths()

Getting data from Worldometers.info

worldometers

python covid = Covid(source="worldometers")

Get Data

python covid.get_data()

Result

```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') } ... ]

```

Get Status By Country Name

python covid.get_status_by_country_name("italy")

Result

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') }

List Countries

python countries = covid.list_countries()

Result

python [ 'china', 'italy', 'usa', 'spain', 'germany', ... ]

Get Total Active cases

python active = covid.get_total_active_cases()

Get Total Confirmed cases

python confirmed = covid.get_total_confirmed_cases()

Get Total Recovered cases

python recovered = covid.get_total_recovered()

Get Total Deaths

python deaths = covid.get_total_deaths()

CLI 2.0 (New)

bash covid --help

Get all data

John Hopkins source (default)

bash covid

or

bash covid -s john_hopkins

Worldometers source

bash covid -s worldometers

List Countries

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

Get Status By Country Name

bash covid -s worldometers -c sweden

Get Total Active cases

bash covid -s worldometers -o active

Get Total Confirmed cases

bash covid -s worldometers -o confirmed

Get Total Recovered cases

bash covid -s worldometers -o recovered

Get Total Deaths

bash covid -s worldometers -o deaths

Issues

Bump certifi from 2021.10.8 to 2022.12.7

opened on 2022-12-08 12:40:57 by dependabot[bot]

Bumps certifi from 2021.10.8 to 2022.12.7.

Commits


Dependabot compatibility score

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.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/nf1s/covid/network/alerts).

Bump ipython from 7.28.0 to 7.31.1

opened on 2022-01-21 19:18:10 by dependabot[bot]

Bumps ipython from 7.28.0 to 7.31.1.

Commits


Dependabot compatibility score

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.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/nf1s/covid/network/alerts).

Releases

v2.5.0 2021-05-30 08:39:53

Feature

  • adds new fields for worldometers (new_cases, new_deaths, active_cases)
  • old fields should still work (confirmed, active)

v2.4.2 2021-05-30 08:06:52

Bugfix

  • updates dependencies to latest versions

v2.4.1 2021-04-26 14:46:18

bugfix allow None values

v2.2.11 2020-06-09 07:23:33

Bugfix

  • fixes John Hopkins API recovered attribute None values

v2.2.10 2020-05-15 20:41:27

Bugfix

  • fixes worldometers population issue

v2.2.9 2020-05-15 20:38:53

Bugfix

  • fixes circleci context for pypi credentials
NF1S

I am an IT veteran with focus on software development for web applications

GitHub Repository Homepage

covid-19 covid-virus coronavirus covid covid-2019 covid-api python python36