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.0.tar.gz (12.2 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.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: opsgw_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 12.2 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.0.tar.gz
Algorithm Hash digest
SHA256 5c6a2ede5bc19020baf56025b9f4e3583cec2039b997b77adba8557111ca5aee
MD5 5fa0dd2f800178ded2bfb2fba0798752
BLAKE2b-256 bc6667d5c83d403c331ee79586fb83e45c14a812eb4bfcc957596849ada88b17

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opsgw_sdk-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a65800f772ce413420e2f42a0eb6bf1e6bf8c2a73343e4a9dc21941825565a81
MD5 598d63335960423a8f870d8c12e6e02c
BLAKE2b-256 62423813f261728e8216e38ccaae77eba923d547884ea008faa733ad95f5d616

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