Metadata-Version: 2.4
Name: majatech-vendorhub
Version: 1.0.6
Summary: Majatech VendorHub API Python SDK — 商户接入与业务接口调用客户端
Author: Majatech VendorHub Qius
License-Expression: MIT
Project-URL: Homepage, https://api.majatechng.com
Project-URL: Documentation, https://api.majatechng.com/vendorhub/merchant/apis
Project-URL: Repository, https://github.com/majatech/vendorhub-python
Keywords: majatech,vendorhub,api,sdk,merchant
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Dynamic: license-file

# Majatech VendorHub Python SDK

Majatech VendorHub API 的 Python 客户端库，支持商户接入、签名认证、Token 管理及业务接口调用。

## 安装

```bash
pip install majatech_vendorhub
```

## 快速开始

```python
from majatech_vendorhub import VendorHub

client = VendorHub(
    access_key="your-access-key",
    access_secret="your-access-secret",
    vendor_code="your-vendor-code",
    country_code="your-country-code",
)

try:
    response = client.request_api(
        api_code="Some.Api.Code",
        data={"test_filed": "test_content"},
    )
    print(response.code)       # 0 表示成功
    print(response.message)    # 响应消息
    print(response.data)       # 业务数据
    print(response.raw)        # 原始响应
finally:
    client.close()
```

## 支持上下文管理器

```python
with VendorHub(
    access_key="...",
    access_secret="...",
    vendor_code="...",
    country_code="...",
) as client:
    response = client.request_api("Some.Api.Code", data={})
```

## 异常处理

```python
from majatech_vendorhub import (
    VendorHubError,
    AuthenticationError,
    TokenExpiredError,
    APIRequestError,
)

try:
    response = client.request_api("Some.Api.Code", data={})
except AuthenticationError as e:
    print(f"认证失败: {e}, 错误码: {e.code}")
except APIRequestError as e:
    print(f"API 错误: {e}, 错误码: {e.code}")
except VendorHubError as e:
    print(f"业务错误: {e}")
```

## 依赖

- Python >= 3.8
- requests >= 2.25.0

## 构建与发布

```bash
# 构建
python -m build

# 发布到 PyPI
python -m twine upload dist/*
```
