Skip to main content

KdGalaxyAdapter

QDataV2 kd-galaxy 适配器

由 广东轻亿云软件科技有限公司 开发
「轻易云数据集成平台」官方适配器

Python 3.11+ License: MIT PyPI version CI


🚀 快速开始

查看 QUICKSTART.md 获取 5 分钟上手指南。

# 安装
pip install qdata-adapter-kd-galaxy

# 配置环境变量
cp .env.example .env
# 编辑 .env 填入你的 API 凭据

# 运行示例
python examples/quickstart.py

📖 简介

qdata-adapter-kd-galaxy 是 QDataV2 数据集成平台的官方适配器,用于连接 kd-galaxy 平台。


🚀 快速开始

安装

pip install qdata-adapter-kd-galaxy

基础用法

import asyncio
from qdata_adapter_kd_galaxy import KdGalaxyAdapter
from qdata_adapter import ConnectorContext

async def main():
    # 创建连接器上下文
    context = ConnectorContext(
        connector_id="my-connector",
        app_software_code="kd_galaxy",
        base_url="https://api.example.com",
        auth_config={
            "client_id": "your-client-id",
            "client_secret": "your-client-secret",
        },
    )

    # 初始化适配器
    adapter = KdGalaxyAdapter(context)

    # 测试连接
    result = await adapter.test_connection()
    print(f"连接状态: {result.status}")

    # 查询数据
    async for item in adapter.list_objects("orders", page_size=50):
        print(item)

asyncio.run(main())

⚙️ 配置说明

auth_config 格式

根据接口类型不同,auth_config 格式可能不同:

# 示例:OAuth2 认证
{
    "client_id": "应用 Key",
    "client_secret": "应用 Secret",
    "token_url": "https://api.example.com/oauth/token",
}

# 示例:API Key 认证
{
    "api_key": "your-api-key",
    "api_secret": "your-api-secret",
}

# 示例:Session 认证
{
    "username": "用户名",
    "password": "密码",
    "account_id": "账套 ID",
}

settings 配置

{
}

📚 API 文档

KdGalaxyAdapter

适配器主类,继承自 BaseAppAdapter。

方法

方法 说明
authenticate() 获取认证 Token
refresh_token() 刷新 Token
list_objects(type, filters, page_size) 列表查询(自动翻页)
get_object(type, id) 单条查询
create_object(type, data) 创建对象
test_connection() 连接测试

🧪 测试

# 安装开发依赖
pip install -e ".[dev]"

# 运行测试(Mock 模式)
make test

# 使用真实 API 测试(需配置 .env)
USE_REAL_API=true make test

# 录制 HTTP 流量(用于调试)
RECORD_HTTP_TRAFFIC=true make test

# 运行测试(带覆盖率)
make test-cov

# 代码检查
make check

测试配置

  1. 复制 .env.example 为 .env
  2. 填入真实 API 凭据
  3. 运行 USE_REAL_API=true pytest tests/ -v

⚠️ 注意: 真实 API 测试会产生实际调用!

测试数据保存在 tests/data/recordings/(已配置为 Git 忽略)


📄 许可证

本项目采用 MIT License 开源协议。

MIT 许可证是一种宽松的软件许可证,允许:

  • ✅ 自由使用:个人、学术、商业用途均可
  • ✅ 自由修改:可以修改源代码
  • ✅ 自由分发:可以重新分发源代码或二进制版本
  • ✅ 闭源使用:修改后的代码可以闭源
  • ✅ 子许可:可以再许可给其他方

唯一要求是:在所有副本中包含原始许可证和版权声明。

详见 LICENSE 文件。


🏢 关于轻易云数据集成平台

广东轻亿云软件科技有限公司
专注数据集成与处理,提供企业级 ETL/ELT 解决方案
🌐 官网:https://www.qeasy.cloud
📧 开源项目:opensource@qeasy.cloud
📧 商业咨询:vincent@qeasy.cloud


Powered by 广东轻亿云软件科技有限公司

Metadata

Release files for qdata-adapter-kd-galaxy 0.1.0

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

Source distribution (sdist)

Source distribution for qdata-adapter-kd-galaxy 0.1.0
File Size Uploaded
qdata_adapter_kd_galaxy-0.1.0.tar.gz 49.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qdata-adapter-kd-galaxy 0.1.0
File Interpreter ABI Platform
qdata_adapter_kd_galaxy-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 71.1 kB

Release files / qdata_adapter_kd_galaxy-0.1.0.tar.gz

Download URL qdata_adapter_kd_galaxy-0.1.0.tar.gz
Size 49.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7393a3e752ffa404e3c6113400e7c22e9d0d9cc03aebbf3a751ffb2678f764f6
BLAKE2b-256 checksum
How to use checksums
a1bf78d748ee669a202c6822555bc7f6f8bf79a5ffdc4c7e29403f1c28068581
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.

Transparency log

Release files / qdata_adapter_kd_galaxy-0.1.0-py3-none-any.whl

Download URL qdata_adapter_kd_galaxy-0.1.0-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a24ad9834a4269a94f4278de6de2a5448b82e444c8ba6f98b8f61ae73be1163
BLAKE2b-256 checksum
How to use checksums
3568d0ef9edb9935f75f5e4873e563e8c0c8f703c5d1c7fbf7b202e6cbf14f60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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