取得 Proxy
取得 Proxy
Section titled “取得 Proxy”取得一個針對你的目標最佳化的 proxy 端點。
GET /v1/proxy| 參數 | 型別 | 必填 | 說明 |
|---|---|---|---|
target | string | 是 | 目標網域(例如 amazon.com) |
session_lock | boolean | 否 | 在整個 session 中維持相同 IP(預設:false) |
country | string | 否 | ISO 3166-1 alpha-2 國家代碼 |
ip_type | string | 否 | residential、datacenter 或 dedicated |
session_ttl | integer | 否 | Session 逾時秒數(預設: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 Client 使用
Section titled “搭配 HTTP Client 使用”proxy = client.get_proxy(target="amazon.com", session_lock=True)
# 轉換成 requests 相容的 dictproxies = 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 | 沒有符合所需條件的可用 proxy |