scraperapi-python-sdklisted
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