畅捷通开放平台python版sdk
Project description
chanjet-open-sdk
欢迎使用 Chanjet Open SDK for Python
环境要求
-
Chanjet Open SDK for Python 需要配合
Python 3.8
或其以上版本。 -
使用 Chanjet Open SDK for Python 之前 ,您需要先前往畅捷通-开发者中心完成开发者接入的一些准备工作,包括创建应用、获取应用的appKey和appSecret。
安装依赖
推荐通过pip下载
pip install -i https://pypi.org/simple/ chanjet-openapi-python-sdk
快速使用
import logging
from chanjet_openapi_python_sdk.chanjet_client import ChanjetClient
from chanjet_openapi_python_sdk.request.tplus.query_inventory_request import QueryInventoryRequest
from chanjet_openapi_python_sdk.response.tplus.query_inventory_response import QueryInventoryResponse
from chanjet_openapi_python_sdk.content.tplus.query_inventory_content import QueryInventoryContent
from chanjet_openapi_python_sdk.utils.chanjet_logger import ChanjetLogger
def query_inventory_demo():
req = QueryInventoryRequest()
req.request_uri = '/tplus/api/v2/inventory/Query'
# 推荐使用字典传值方式,直接传实体实例会有一定的性能损耗
# req.content = {'param': {'Code': '123'}}
req.content = QueryInventoryContent('124', '123', False, True)
# 支持将返回值解析成实体类属性,如果不传入实体类名,则按照json的格式进行转换成字典、列表、字符串等
result = client.execute(req, QueryInventoryResponse)
return result
if __name__ == '__main__':
# 设置自定义日志配置
ChanjetLogger(logging.INFO)
client = ChanjetClient('https://openapi.chanjet.com')
client.app_key = 'A5tyQHP8'
client.app_secret = '9C910520463F2A473ABA9CE8507004D8'
client.open_token = """eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfdG9rZW4iOiIwNDcyNDhjYS04MjRmLTRiMDEtODFjYi0zOWE3ZTkxYzdiZmUiLCJzdWIiOiJpc3YiLCJhdWQiOiJpc3YiLCJuYmYiOjE2Mjc5NTkyOTEsImFwcElkIjoiNTgiLCJzY29wZSI6ImF1dGhfYWxsIiwiaXNzIjoiY2hhbmpldCIsImV4cCI6MTYyODQ3NzY5MSwidXNlcklkIjoiNjAwMTIzOTUzNjgiLCJpYXQiOjE2Mjc5NTkyOTEsIm9yZ0lkIjoiOTAwMTY0ODg5NzciLCJvcmdBY2NvdW50IjoidTdycnhpaGM5MHU1In0.ffmyeTcm1VK5B5ZSiefECBoGZ9fV9Hk_lWVMX3ldspk"""
# 查询存货
res = query_inventory_demo()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for chanjet-openapi-python-sdk-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 538183b8b5f1aa5dbbcc16c0ea02de930b921f12b396f3875366a85006693399 |
|
MD5 | be33747868d3ed4751381dc306cd90f4 |
|
BLAKE2b-256 | c022c860653de6f9265c9af578df8f8b86e604103a397dca51ab00b19bc0667d |
Close
Hashes for chanjet_openapi_python_sdk-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fe90db04c1af752f9722cbcde6b802a90c15316ec2313b3465decfd573f260b |
|
MD5 | 7dac4661db0af325ac4fb8ecd1fe019e |
|
BLAKE2b-256 | fecc7e33997f4f9ba3f8560d956168b93035e855ae3d0442eb716144748e6ab1 |