Skip to main content

一个包装器,允许用户从 Covid Act Now 数据库中获取特定的基于州的 COVID 统计数据。

项目描述

Covid Act Now 数据库包装器

这个包是 Covid Act Now 的 COVID-19 相关信息数据库的一个非常简单的包装器。在此处查看 PyPi 项目,并在此处查看原始帖子页面。

用法很简单。使用pip install covidactnow.

使用您的 API 密钥作为参数实例化一个用户对象。您可以在此处轻松生成 API 密钥。

import covidactnow

api = covidactnow.User(api_key = 'yourapikey')

washingtonInfectionRate = api.infRate('WA')
massachussettsVaxRate = api.vaxRate('MA')

print(f"{washingtonInfectionRate = }")
print(f"{massachussettsVaxRate = }")

这将导致(当然,使用不同的数据):

washingtonInfectionRate = 1.16
massachussettsVaxRate = 76.3

要查看特定函数的文档字符串(解释器),请使用covidactnow.User.infRate.__doc__whereinfRate可以替换为任何其他函数。例如,运行print(covidactnow.User.freeBedPercentage.__doc__)将返回:Get's the percentage of free hospital beds by state.根据您的 IDE,将鼠标悬停在编辑器中的某个函数上将显示该函数的文档字符串(适用于 VS Code)。

import covidactnow

if __name__ == "__main__":
    print(covidactnow.User.infRate.__doc__)
    print(covidactnow.User.freeBedPercentage.__doc__)

""" Result:

>>> Gets today's COVID infection rate by state.
>>> Get's the percentage of free hospital beds by state.

"""

----
For more information on how the wrapper works, particularly how it was redesigned to be package-friendly, read the "Updated for Distribution" section of this [page](https://covidinfo.preritdas.com). Note that this version has been updated to get data from within a `User` class allowing individual API keys to be used (as opposed to defining a state as an object and defining statistics as object attributes).

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

covidactnow-1.1.76.tar.gz (3.1 kB 查看哈希

已上传 source

内置分布

covidactnow-1.1.76-py3-none-any.whl (3.2 kB 查看哈希

已上传 py3