← ClaudeAtlas

scraperapi-python-sdklisted

Best-practices reference for the ScraperAPI Python SDK (scraperapi-sdk package). Consult whenever the user is writing, debugging, or reviewing Python code that calls ScraperAPI. Use when user asks: "scrape a website with Python and ScraperAPI", "how do I use ScraperAPIClient", "ScraperAPI Python render example", "Python ScraperAPI async", "batch scraping Python ScraperAPI", "ScraperAPI premium Python", "how to handle ScraperAPI errors in Python", "ScraperAPI structured data Python". Covers client setup, all request parameters, the escalation ladder (standard → render → premium → ultra_premium), async jobs for batches, structured data endpoints, error handling, and credit budgeting.
scraperapi/scraperapi-skills · ★ 9 · API & Backend · score 78
Install: claude install-skill scraperapi/scraperapi-skills
# ScraperAPI — Python SDK Best Practices **Requires:** Python 3.7+, `pip install scraperapi-sdk`, `SCRAPERAPI_API_KEY` environment variable. ## Setup ```python import os from scraperapi_sdk import ScraperAPIClient client = ScraperAPIClient(os.environ["SCRAPERAPI_API_KEY"]) ``` Never hardcode the API key. Read it from the environment every time. ## Decision Guide Pick the right call pattern before writing any code. | Situation | Pattern | |-----------|---------| | Single URL, response needed immediately | `client.get()` — synchronous | | 20+ URLs, or single URL that often times out | Async Jobs API — `requests.post()` to `async.scraperapi.com/jobs` | | Supported platform (Amazon, Google, Walmart, eBay, Redfin) | Structured Data endpoint — `api.scraperapi.com/structured/<vertical>` | | Page loads content via JavaScript (React, Vue, Angular) | `client.get()` with `render=True` | | Site blocks standard proxies | `client.get()` with `premium=True` | Use the sync SDK for simple, single-URL work. Switch to raw `requests` against the async endpoint for batches — the SDK has no built-in async or batch support. ## Basic Usage ```python # Simple scrape — returns HTML as a string html = client.get(url="https://example.com/") # With parameters html = client.get( url="https://example.com/", params={"render": True, "country_code": "us"} ) ``` ## Parameter Reference ### Rendering ```python # Render JavaScript before returning HTML # Use when: page uses React/Vue/Angula