Python SDK
Python SDK
Section titled “Python SDK”The official Python SDK for HydraSkill. Supports sync and async operations.
Installation
Section titled “Installation”pip install hydraskillQuick Start
Section titled “Quick Start”from hydraskill import ProxyClient
client = ProxyClient(api_key="sk-...")
# Get a proxyproxy = client.get_proxy(target="amazon.com", session_lock=True)
# Use with requestsimport requestsresp = requests.get("https://amazon.com", proxies=proxy.to_dict())
# Release when doneproxy.release()Async Support
Section titled “Async Support”from hydraskill import AsyncProxyClient
client = AsyncProxyClient(api_key="sk-...")
async def scrape(): proxy = await client.get_proxy(target="amazon.com") async with httpx.AsyncClient(proxies=proxy.to_httpx()) as http: resp = await http.get("https://amazon.com") await proxy.release()Integration with Playwright
Section titled “Integration with Playwright”from hydraskill import ProxyClientfrom playwright.sync_api import sync_playwright
client = ProxyClient()proxy = client.get_proxy(target="amazon.com", session_lock=True)
with sync_playwright() as p: browser = p.chromium.launch(proxy={ "server": proxy.to_playwright_server(), "username": proxy.username, "password": proxy.password, }) page = browser.new_page() page.goto("https://amazon.com")Configuration
Section titled “Configuration”client = ProxyClient( api_key="sk-...", timeout=30, # request timeout in seconds max_retries=3, # retry on transient errors base_url="https://api.hydraskill.ai", # custom endpoint)Error Handling
Section titled “Error Handling”from hydraskill.exceptions import ( AuthenticationError, RateLimitError, ProxyExhaustedError, InsufficientBalanceError,)
try: proxy = client.get_proxy(target="example.com")except RateLimitError as e: print(f"Rate limited. Retry after {e.retry_after_ms}ms")except InsufficientBalanceError: print("Upgrade your plan or add traffic")