Unofficial Python SDK for the CameronSino CIM Admin API.
Project description
cim-sdk
非官方的 CameronSino CIM Admin API Python SDK。支持通过 pip install . 安装,提供订单与交易记录的便捷访问,并附带基于 cs_user_info 的 token 复用工厂。
安装
在项目根目录执行:
python -m pip install .
快速开始
from cim_sdk import CIMClient
# 方式 1:提供账号直接登录
client = CIMClient.from_credentials("username", "password")
# 方式 2:已有 token 直接复用
another = CIMClient(token="EXISTING_ACCESS_TOKEN")
# Dropship 订单详情
detail = client.orders.get_detail("US-3729797")
print(detail)
# 最近三天的交易记录
records = client.transactions.get_recent_records(page_size=100)
print(records)
Token 持久化与自动登录(业务侧)
SDK 内置了工厂 cim_sdk.token_manager.get_cim_client_for_username,按照 cs_user_info 表结构(见 AGENTS.md)工作:
from cim_sdk.token_manager import get_cim_client_for_username
# db_conn 需实现标准 DB-API(cursor/execute/commit),如 PyMySQL 的连接对象
client = get_cim_client_for_username(db_conn, "andy")
# 如果数据库里 token 未过期,将直接 set_token;否则自动调用 /auth/login 并写回新 token。
orders = client.orders.list_page(page_no=1, page_size=20)
开发与测试
- 运行基础单测(需安装 pytest):
python -m pytest - 本地打包验证安装:
python -m pip install .
目录结构
cim_sdk/:SDK 代码与 token 工厂tests/:简单的导入测试与使用示例pyproject.toml:打包配置
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
cim_sdk-0.1.1.tar.gz
(10.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
cim_sdk-0.1.1-py3-none-any.whl
(10.8 kB
view details)
File details
Details for the file cim_sdk-0.1.1.tar.gz.
File metadata
- Download URL: cim_sdk-0.1.1.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd9fefe46588cea659299f061ed99819ec2e41ce1cb573700367e25b21aebe56
|
|
| MD5 |
9cd0e0a1e10c3b86c9875dcfcf07694f
|
|
| BLAKE2b-256 |
ce2dfb90d2f94dc55d4ba4209cc850ae967c29c25c1cdcd7191286c9bbfa1fa8
|
File details
Details for the file cim_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cim_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
050f30dced004b394840b872d8199a2d8c6d67ab2ad7ca92d0136e97c2b17d24
|
|
| MD5 |
1e4cb2c807d1cf28f738b6abcb4c1453
|
|
| BLAKE2b-256 |
63f07174f2a4b3da10b51b860803ef5ccc50df6b97ab264cd60a0ef0ef0f7658
|