Skip to main content

Async Covid

Based on Ahmednafies' COVID module.

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

Requirements

python >= 3.6

How to install

pip install async-covid

Dependencies

pydantic
asyncio
aiohttp

How to use

Example

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

Get All Data

await covid.get_data()

Result

[
    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.

await covid.list_countries()

Result

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

Get Status By Country ID

await covid.get_status_by_country_id(14)

Result

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

 await covid.get_status_by_country_name("bangladesh")

Result

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

await covid.get_total_active_cases()

Get Total Confirmed cases

await covid.get_total_confirmed_cases()

Get Total Recovered cases

await covid.get_total_recovered()

Get Total Deaths

await covid.get_total_deaths()

Getting data from Worldometers.info

worldometers

covid = Covid(source="worldometers")

Get Data

await covid.get_data()

Result

[
    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

await covid.get_status_by_country_name("india")

Result

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

List Countries

countries = await covid.list_countries()

Result

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

Get Total Active cases

active = await covid.get_total_active_cases()

Get Total Confirmed cases

confirmed = await covid.get_total_confirmed_cases()

Get Total Recovered cases

recovered = await covid.get_total_recovered()

Get Total Deaths

deaths = await covid.get_total_deaths()


Metadata

Release files for async-covid 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for async-covid 0.0.11
File Size Uploaded Provenance Actions
async-covid-0.0.11.tar.gz 9.2 kB Without provenance Details for async-covid-0.0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for async-covid 0.0.11
File Interpreter ABI Platform Actions
async_covid-0.0.11-py3-none-any.whl Python 3 none any Details for async_covid-0.0.11-py3-none-any.whl

Total release size: 19.1 kB

Release files / async-covid-0.0.11.tar.gz

Download URL async-covid-0.0.11.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f924903161b9e12d8b406512668af6258d255489b58a9ae3b21c1b9bb05e72c2
BLAKE2b-256 checksum
How to use checksums
f1fc9d9a16ce00a32bf2384d97b8cf11b580ab6f13eddc77b1e96f0765d9e782
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.2

Release files / async_covid-0.0.11-py3-none-any.whl

Download URL async_covid-0.0.11-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e1bc50e337ef02827af13df29c533fd749f86f5b3abb72a5823464c0454a26c
BLAKE2b-256 checksum
How to use checksums
6c3ef5f3775aeb010da84ebde9529085faadb361418a6db6907088f47ebcb448
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.2

Security for async-covid 0.0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.11 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page