Skip to main content

shangjian_api

安装

python -m pip install shangjian_api

用法

AirWorks Api

基础用法

import json
from shangjian_api.airworks.package_api import AirWorksApi

awp = AirWorksApi(
    base_url="api.airworks.shangjian.tech:30000",
    access_key="xxx",
    access_secret="xxx",
    default_app_id=1,
    default_api_method="GET",
    default_page_num=1,
    default_page_size=100
)

res = awp.call(
    app_url="api_gateway/api/1/daily",
    port_code='',
    date='',
    api_method="GET"
)
print(json.dumps(res, indent=2, ensure_ascii=False))

使用本地配置文件时

import json
from shangjian_api.airworks.package_api import AirWorksApi

awp = AirWorksApi(
    default_app_id=1,
    default_api_method="GET",
    default_page_num=1,
    default_page_size=100
)

使用api别名作为函数名来调用

res = awp.daily(
    app_id=1,
    port_code='',
    date='',
    api_method="GET"
)
print(json.dumps(res, indent=2, ensure_ascii=False))

KM Api

from shangjian_api.km.base_api import get_indicator_values

indicator_ids = ["all_indexpv_chain_rank_app_by_week_all"]
result = get_indicator_values(indicator_ids)
print(result)

配置文件内容

文件路径: 包安装路径下名为 sdk_config.toml 的文件, 例如 /usr/lib/python3.8/site-packages/shangjian_api-0.0.2-py3.8.egg/shangjian_api/sdk_config.toml 内容如下

title = "sdk config"

[km]
[km.indicator]
#host = "localhost:8888"
host = ""
username = ""
password = ""

# airworks
[airworks]
[airworks.api]
#host = "localhost:8888"
host = ""
access_key = ""
access_secret = ""

开发

可将包内代码复制,并修改顶级包名,可新增功能,但需要在理解逻辑的前提下修改现有代码

release log

20211028

  • km get_indicator_values 接口返回值有序

20210826

  • 添加支持本地配置文件功能
  • 支持顶级包名可变

Metadata

Release files for shangjian-api 0.0.6

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

Source distribution (sdist)

Source distribution for shangjian-api 0.0.6
File Size Uploaded Provenance Actions
shangjian_api-0.0.6.tar.gz 7.3 kB Without provenance Details for shangjian_api-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shangjian-api 0.0.6
File Interpreter ABI Platform Actions
shangjian_api-0.0.6-py3-none-any.whl Python 3 none any Details for shangjian_api-0.0.6-py3-none-any.whl

Total release size: 15.9 kB

Release files / shangjian_api-0.0.6.tar.gz

Download URL shangjian_api-0.0.6.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
515707b6abbfdea785277b37195a5d06c492406ddbabfb526dd20dfeba5ea58a
BLAKE2b-256 checksum
How to use checksums
8bb8d01a15b6a03a2e9d85522a7f3cf2bfeba65b7f17984d8ca4a61837c0fe3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.10

Release files / shangjian_api-0.0.6-py3-none-any.whl

Download URL shangjian_api-0.0.6-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30a8a5e0ade2f7926442798ee8ec280d44140c5e60fdb8092819cc591e91e2d6
BLAKE2b-256 checksum
How to use checksums
d1e57bb15b94058c39d5efbad788384fb22c9302db0f9e5f496acd825acbd2cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.10

Security for shangjian-api 0.0.6

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.

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