クイックスタート
クイックスタート
Section titled “クイックスタート”このガイドでは、ゼロの状態から 2 分以内に動作するプロキシリクエストを実現します。
- HydraSkill アカウント(無料登録)
- API key(Dashboard → API Keys から)
- Python 3.8 以上(または Node.js 18 以上)
ステップ 1:インストール
Section titled “ステップ 1:インストール”pip install hydraskillステップ 2:初期化
Section titled “ステップ 2:初期化”from hydraskill import ProxyClient
client = ProxyClient(api_key="sk-your-key-here")または環境変数を設定し、パラメータを省略します:
export HYDRASKILL_API_KEY="sk-your-key-here"client = ProxyClient() # 環境変数から自動読み取りステップ 3:プロキシを取得
Section titled “ステップ 3:プロキシを取得”proxy = client.get_proxy( target="amazon.com", session_lock=True, country="US")
print(proxy.ip) # 203.0.113.42print(proxy.country) # USprint(proxy.type) # residentialステップ 4:利用する
Section titled “ステップ 4:利用する”import requests
response = requests.get( "https://www.amazon.com/dp/B09V3KXJPB", proxies=proxy.to_dict())
print(response.status_code) # 200裏側で起きていること
Section titled “裏側で起きていること”- HydraSkill が対象ドメイン(
amazon.com)を分析 - 最適な IP タイプを選択(EC には residential)
- US プールから IP を割り当て
- その IP をセッションにロック(解放するまで変わらない)
- IP がブロックされた場合 → 新しい IP へ自動切り替え、透過的に再試行
完全な例:ウェブスクレイピングエージェント
Section titled “完全な例:ウェブスクレイピングエージェント”from hydraskill import ProxyClientimport requests
client = ProxyClient()
# 同じ IP で 100 件の商品ページをスクレイピングproxy = client.get_proxy(target="amazon.com", session_lock=True)
for product_id in product_ids: url = f"https://www.amazon.com/dp/{product_id}" resp = requests.get(url, proxies=proxy.to_dict())
if resp.status_code == 200: parse_product(resp.text) # 403/429 を処理する必要なし — HydraSkill が自動修復
# 完了 — プロキシを解放proxy.release()Node.js の例
Section titled “Node.js の例”import { ProxyClient } from 'hydraskill';
const client = new ProxyClient({ apiKey: process.env.HYDRASKILL_API_KEY });
const proxy = await client.getProxy({ target: 'amazon.com', sessionLock: true, country: 'US',});
const response = await fetch('https://www.amazon.com/dp/B09V3KXJPB', { agent: proxy.toAgent(),});
console.log(response.status); // 200await proxy.release();次のステップ
Section titled “次のステップ”- Session Lock — IP バインディングを理解する
- Auto-Heal — フェイルオーバーの仕組み
- API リファレンス — 全エンドポイントのドキュメント