Metadata-Version: 2.4
Name: opsgw-sdk
Version: 1.0.1
Summary: 具有健康监测功能的HTTP SDK
Home-page: https://github.com/opsgw/opsgw-sdk-python
Author: OpsGW Team
Author-email: team@opsgw.com
Project-URL: Bug Reports, https://github.com/opsgw/opsgw-sdk-python/issues
Project-URL: Source, https://github.com/opsgw/opsgw-sdk-python
Project-URL: Documentation, https://github.com/opsgw/opsgw-sdk-python/blob/main/README.md
Keywords: http client sdk health check dns load balancer
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
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: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.31.0
Requires-Dist: dnspython>=2.4.0
Requires-Dist: aiohttp>=3.8.0
Requires-Dist: asyncio-throttle>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.18.0; extra == "dev"
Requires-Dist: pytest-cov>=2.10; extra == "dev"
Requires-Dist: black>=21.0; extra == "dev"
Requires-Dist: flake8>=3.8; extra == "dev"
Requires-Dist: mypy>=0.800; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# OpsGW HTTP SDK

一个具有健康监测功能的HTTP SDK，支持自动检测域名IP的健康状态，并只向健康的IP发送请求。

## 特性

- 自动DNS解析和IP健康监测
- 后台健康检查，实时更新IP状态
- 智能负载均衡，只向健康IP发送请求
- 支持同步和异步请求
- 可配置的健康检查参数
- 自动故障转移

## 安装

```bash
pip install -r requirements.txt
```

## 使用示例

```python
from opsgw_sdk import OpsGWClient

# 初始化客户端
client = OpsGWClient(
    domain="api.example.com",
    health_check_interval=30,  # 健康检查间隔（秒）
    health_check_timeout=5,    # 健康检查超时（秒）
    max_retries=3              # 最大重试次数
)

# 发送GET请求
response = client.get("/users", params={"page": 1})

# 发送POST请求
response = client.post("/users", json={"name": "John", "email": "john@example.com"})

# 发送PUT请求
response = client.put("/users/1", json={"name": "John Updated"})

# 发送DELETE请求
response = client.delete("/users/1")
```

## 异步使用

```python
import asyncio
from opsgw_sdk import AsyncOpsGWClient

async def main():
    async with AsyncOpsGWClient("api.example.com") as client:
        # 异步请求
        response = await client.get("/users")
        data = await response.json()
        print(data)

asyncio.run(main())
``` 
