Tool for shangjian sdk
Project description
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
- 添加支持本地配置文件功能
- 支持顶级包名可变
Project details
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)
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 515707b6abbfdea785277b37195a5d06c492406ddbabfb526dd20dfeba5ea58a |
|
MD5 | 178c5c1c7a6996cfb33abc7c7234e79b |
|
BLAKE2b-256 | 8bb8d01a15b6a03a2e9d85522a7f3cf2bfeba65b7f17984d8ca4a61837c0fe3f |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30a8a5e0ade2f7926442798ee8ec280d44140c5e60fdb8092819cc591e91e2d6 |
|
MD5 | ea160eb38ce3ee154f8d7390d60c98f7 |
|
BLAKE2b-256 | d1e57bb15b94058c39d5efbad788384fb22c9302db0f9e5f496acd825acbd2cd |