Skip to main content

具有健康监测功能的HTTP SDK

Project description

OpsGW HTTP SDK

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

特性

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

安装

pip install -r requirements.txt

使用示例

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")

异步使用

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())

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

opsgw_sdk-1.0.1.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

opsgw_sdk-1.0.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file opsgw_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: opsgw_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for opsgw_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 763e26f1ff25b19f998c95b9591ad9d2035cb461de62ed18a818fb7b21f83ac0
MD5 8e9254edbeb0f7a7b55b39cd42168af1
BLAKE2b-256 c1dbba549f3dc895f39b486e382d59c45e572c458ad5a3fba4e0f1944890a276

See more details on using hashes here.

File details

Details for the file opsgw_sdk-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: opsgw_sdk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for opsgw_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9776605e62cefcf495e138487c4b8782be0785512fc79c2c0fb226867aee4ec2
MD5 c07d25fbfcec0b4b93018b7259f9dc9d
BLAKE2b-256 a035478d86bdb9655a147a9582694dd8b2819197ca35601ad22003948488fb9e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page