Metadata-Version: 2.1
Name: async-covid
Version: 0.0.11
Summary: An async Python package to get information regarding the novel corona virus provided by Johns Hopkins university and worldometers.info. Based on https://github.com/ahmednafies/covid
Home-page: UNKNOWN
Author: K.M Ahnaf Zail
Author-email: ahnafzamil@protonmail.com
License: MIT
Project-URL: Source, https://github.com/ahnaf-zamil/async-covid
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Topic :: Utilities
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: aiohttp
Requires-Dist: asyncio
Requires-Dist: beautifulsoup4
Requires-Dist: pydantic
Requires-Dist: typer
Provides-Extra: dev
Requires-Dist: black ; extra == 'dev'
Requires-Dist: coverage ; extra == 'dev'
Requires-Dist: flake8 ; extra == 'dev'
Requires-Dist: ipdb ; extra == 'dev'
Requires-Dist: pipenv ; extra == 'dev'
Requires-Dist: pre-commit ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'

# Async Covid

Based on Ahmednafies' COVID [module](https://github.com/ahmednafies/covid).

## Description

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

Documentation not ready yet, but everything is shown in this README file.

![corona.jpeg](https://raw.githubusercontent.com/ahmednafies/covid/master/docs/img/corona.jpeg)

## Requirements

    python >= 3.6

## How to install

    pip install async-covid

## Dependencies

    pydantic
    asyncio
    aiohttp

## How to use

### Example

```python
import asyncio
from async_covid import Covid

async def main():
    print(await covid.get_data())

if __name__ == __main__:
    covid = COVID()
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    loop.close()
```

## John Hopkins University API

![john_hopkins](https://raw.githubusercontent.com/ahmednafies/covid/master/docs/img/john_hopkins.png)

### Get All Data

```python
await covid.get_data()
```

#### Result

```python
[
    CovidModel<
        id=175, 
        country=US, 
        confirmed=7554434, 
        active=4342532, 
        deaths=211905, 
        recovered=2999895, 
        latitude=40.0, 
        longitude=-100.0, 
        last_update=1602163423000
        >,
    CovidModel<
        id=14, 
        country=Bangladesh,
        confirmed=374592, 
        active=80816,
        deaths=5460,
        recovered=288316,
        latitude=23.685, 
        longitude=90.3563, 
        last_update=1602163423000
        >,
    ...
]
```

### 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
await covid.list_countries()
```

#### Result

```python
[
    CountryModel<id=175, name=US>, 
    CountryModel<id=80, name=India>,
    ...
]
```

### Get Status By Country ID

```python
await covid.get_status_by_country_id(14)
```

#### Result

```python
CovidModel<
    id=14, 
    country=Bangladesh, 
    confirmed=374592,
    active=80816,
    deaths=5460, 
    recovered=288316,
    latitude=23.685,
    longitude=90.3563,
    last_update=1602163423000
>
```

### Get Status By Country Name

```python
 await covid.get_status_by_country_name("bangladesh")
```

#### Result

```python
CovidModel<
    id=14, 
    country=Bangladesh, 
    confirmed=374592,
    active=80816,
    deaths=5460, 
    recovered=288316,
    latitude=23.685,
    longitude=90.3563,
    last_update=1602163423000
>
```

### Get Total Active cases

```python
await covid.get_total_active_cases()
```

### Get Total Confirmed cases

```python
await covid.get_total_confirmed_cases()
```

### Get Total Recovered cases

```python
await covid.get_total_recovered()
```

### Get Total Deaths

```python
await covid.get_total_deaths()
```

## Getting data from Worldometers.info

![worldometers](https://raw.githubusercontent.com/ahmednafies/covid/master/docs/img/worldometers.png)

```python
covid = Covid(source="worldometers")
```

### Get Data

```python
await covid.get_data()
```

#### Result

```python
[
    CovidModel<
    country=North America, 
    confirmed=9332106, 
    new_cases=10355, 
    deaths=322513, 
    recovered=6101706,
    active=2907887, 
    critical=17932,
    new_deaths=512,
    total_tests=0,
    total_tests_per_million=0,
    total_cases_per_million=0, 
    total_deaths_per_million=0,
    population=0>
    ...
]

```

### Get Status By Country Name

```python
await covid.get_status_by_country_name("india")
```

#### Result

```python
CovidModel<
country=India,
confirmed=6835655,
new_cases=2667,
deaths=105554,
recovered=5827704,
active=902397,
critical=8944,
new_deaths=0, 
total_tests=83465975
>
```

### List Countries

```python
countries = await covid.list_countries()
```

#### Result

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

### Get Total Active cases

```python
active = await covid.get_total_active_cases()
```

### Get Total Confirmed cases

```python
confirmed = await covid.get_total_confirmed_cases()
```

### Get Total Recovered cases

```python
recovered = await covid.get_total_recovered()
```

### Get Total Deaths

```python
deaths = await covid.get_total_deaths()
```

```


