导出carto用户数据库度量的模块
carto-report的Python项目详细描述
CARTO报告
一个python模块,用于将数据库度量导出为carto组织用户的html文件。
安装
您可以通过克隆此存储库或使用Pip:
$ pip install carto-report
如果您想使用开发版本,可以直接从github安装:
$ pip install -e git+git://github.com/CartoDB/carto-report.git#egg=carto
如果使用开发版本,您可能还需要安装依赖项:
$ pip install -r requirements.txt
仅在python 3中测试
该软件包安装一个命令行应用程序 其中不同的参数是:用法示例
命令行应用程序
carto_report
,该程序具有以下使用说明:$ carto_report -h
usage: carto_report [-h] [--user-name CARTO_USER] [--api_key CARTO_API_KEY]
[--api_url CARTO_API_URL] [--organization CARTO_ORG]
[--output OUTPUT] [--quota QUOTA]
[--loglevel {DEBUG,INFO,WARNING,ERROR}]
CARTO reporting tool
optional arguments:
-h, --help show this help message and exit
--user-name CARTO_USER, -U CARTO_USER
Account user name (defaults to env variable
CARTO_USER)
--api_key CARTO_API_KEY, -a CARTO_API_KEY
Api key of the account (defaults to env variable
CARTO_API_KEY)
--api_url CARTO_API_URL, -u CARTO_API_URL
Set the base URL. For example:
https://username.carto.com/ (defaults to env variable
CARTO_API_URL)
--organization CARTO_ORG, -o CARTO_ORG
Set the name of the organization account (defaults to
env variable CARTO_ORG)
--output OUTPUT File path for the report, defaults to report.html
--quota QUOTA, -q QUOTA
LDS quota for the user, defaults to 5000
--loglevel {DEBUG,INFO,WARNING,ERROR}, -l {DEBUG,INFO,WARNING,ERROR}
How verbose the output should be, default to the most
silent
作为python模块
fromcarto_report.reportimportReporterreporter=Reporter(CARTO_USER,CARTO_API_URL,CARTO_ORG,API_KEY,USER_QUOTA)withopen('/tmp/report.html','w')aswriter:writer.write(reporter.report())
CARTO_USER
:要检查的帐户的用户名CARTO_API_URL
:这通常是https://{CARTO_USER}.carto.com/
,但如果不使用carto.com
帐户,则可能有所不同。
CARTO_API_KEY
:您的carto引擎主api密钥USER_QUOTA
:您的lds配额已知问题
推荐PyPI第三方库