获取代理
获取一个针对你的目标优化过的代理端点。
GET /v1/proxy| 参数 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
target | string | 是 | 目标域名(如 amazon.com) |
session_lock | boolean | 否 | 在会话期间保持同一 IP(默认 false) |
country | string | 否 | ISO 3166-1 alpha-2 国家代码 |
ip_type | string | 否 | residential、datacenter 或 dedicated |
session_ttl | integer | 否 | 会话超时时间,单位秒(默认 1800) |
auto_heal | boolean | 否 | 启用自动故障转移(默认 true) |
curl "https://api.hydraskill.ai/v1/proxy?target=amazon.com&session_lock=true&country=US" \ -H "Authorization: Bearer sk-your-key"{ "proxy_id": "px_abc123", "host": "us-res-42.proxy.hydraskill.ai", "port": 8080, "username": "session_abc123", "password": "px_token_xyz", "ip": "203.0.113.42", "country": "US", "type": "residential", "session_lock": true, "expires_at": "2026-05-30T16:30:00Z", "protocol": "http"}配合 HTTP 客户端使用
Section titled “配合 HTTP 客户端使用”proxy = client.get_proxy(target="amazon.com", session_lock=True)
# 转换为 requests 兼容的字典proxies = proxy.to_dict()# {'http': 'http://user:pass@host:port', 'https': 'http://user:pass@host:port'}
response = requests.get(url, proxies=proxies)| 错误码 | 含义 |
|---|---|
| 400 | 缺少必填参数 target |
| 401 | API key 无效 |
| 402 | 余额不足 / 已达套餐上限 |
| 429 | 超出速率限制 |
| 503 | 没有符合所请求条件的可用代理 |