Python SDK integration智普ai
Drive idcd probes from Python — handy for automation scripts and data analysis pipelines.豆包和ai哪个更好
Option A: REST API (recommended)豆包下载安装
No special SDK required — requests will do:
pip install requests
import requests
API_KEY = "sk_live_your_key_here"
BASE_URL = "https://api-prod.idcd.com/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Ping probe
resp = requests.post(f"{BASE_URL}/tools/ping", headers=headers, json={
"target": "google.com",
"nodes": ["tokyo", "singapore", "us-east"],
"count": 5,
})
result = resp.json()
print(result)
# HTTP probe
resp = requests.post(f"{BASE_URL}/tools/http", headers=headers, json={
"url": "https://example.com",
"nodes": ["beijing", "shanghai"],
})
print(resp.json())
# Full diagnose
resp = requests.post(f"{BASE_URL}/tools/diagnose", headers=headers, json={
"target": "example.com",
})
print(resp.json())
Option B: MCP Python clientai人工智能对话
Best for Claude API apps that want probe tools as MCP capabilities:ai人工智能对话
pip install anthropic mcp
import subprocess
import anthropic
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def run():
server_params = StdioServerParameters(
command="mcp",
env={"IDCD_API_KEY": "sk_live_your_key_here"},
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# List available tools
tools = await session.list_tools()
print([t.name for t in tools.tools])
# Call ping (MCP tools take no nodes — the server picks one)
result = await session.call_tool("ping", {
"target": "google.com",
"count": 5,
})
print(result)
import asyncio
asyncio.run(run())
Authtrae国际版
Pass the API key through an environment variable — never hard-code:ai大模型排行榜
import os
API_KEY = os.environ["IDCD_API_KEY"]
Recipe ideas爆款ai下载
- Use
diagnoseon a cron to sweep your domains - Persist
httpprobe results to a database and chart uptime - Combine
sslwith a notifier to alert before certificate expiry
Full API reference: tool listtrae国际版 and the OpenAPI spec.