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

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shangjian_api-0.0.6.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shangjian_api-0.0.6-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file shangjian_api-0.0.6.tar.gz.

File metadata

  • Download URL: shangjian_api-0.0.6.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.10

File hashes

Hashes for shangjian_api-0.0.6.tar.gz
Algorithm Hash digest
SHA256 515707b6abbfdea785277b37195a5d06c492406ddbabfb526dd20dfeba5ea58a
MD5 178c5c1c7a6996cfb33abc7c7234e79b
BLAKE2b-256 8bb8d01a15b6a03a2e9d85522a7f3cf2bfeba65b7f17984d8ca4a61837c0fe3f

See more details on using hashes here.

File details

Details for the file shangjian_api-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: shangjian_api-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.10

File hashes

Hashes for shangjian_api-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 30a8a5e0ade2f7926442798ee8ec280d44140c5e60fdb8092819cc591e91e2d6
MD5 ea160eb38ce3ee154f8d7390d60c98f7
BLAKE2b-256 d1e57bb15b94058c39d5efbad788384fb22c9302db0f9e5f496acd825acbd2cd

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page