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 广东轻亿云软件科技有限公司

Download files

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

Source Distribution

qdata_adapter_kd_galaxy-0.1.0.tar.gz (49.6 kB view details)

Uploaded Source

Built Distribution

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

qdata_adapter_kd_galaxy-0.1.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file qdata_adapter_kd_galaxy-0.1.0.tar.gz.

File metadata

  • Download URL: qdata_adapter_kd_galaxy-0.1.0.tar.gz
  • Upload date:
  • Size: 49.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qdata_adapter_kd_galaxy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7393a3e752ffa404e3c6113400e7c22e9d0d9cc03aebbf3a751ffb2678f764f6
MD5 1d8e1d31312da915ef128850defbfbe7
BLAKE2b-256 a1bf78d748ee669a202c6822555bc7f6f8bf79a5ffdc4c7e29403f1c28068581

See more details on using hashes here.

Provenance

The following attestation bundles were made for qdata_adapter_kd_galaxy-0.1.0.tar.gz:

Publisher: publish.yml on vincent067/qdata-adapter-kd-galaxy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qdata_adapter_kd_galaxy-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for qdata_adapter_kd_galaxy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a24ad9834a4269a94f4278de6de2a5448b82e444c8ba6f98b8f61ae73be1163
MD5 73954fe264ed6ccab2a9051094ea1e66
BLAKE2b-256 3568d0ef9edb9935f75f5e4873e563e8c0c8f703c5d1c7fbf7b202e6cbf14f60

See more details on using hashes here.

Provenance

The following attestation bundles were made for qdata_adapter_kd_galaxy-0.1.0-py3-none-any.whl:

Publisher: publish.yml on vincent067/qdata-adapter-kd-galaxy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

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