How to Migrate from ScrapingBee to AlterLab: Step-by-Step Guide (2026)
TL;DR
To migrate from ScrapingBee to AlterLab, install the AlterLab Python SDK, replace your ScrapingBee client with alterlab.Client, and update your API key. The request format and response structure are nearly identical, so most of your existing code works unchanged.
Why migrate?
ScrapingBee requires a monthly subscription plan even if you use few credits. AlterLab offers a pure pay‑as‑you‑go model: you only pay for what you use, your balance never expires, and there are no mandatory monthly fees.
Prerequisites
- An AlterLab account (create one for free at /signup)
- Your AlterLab API key (found in the dashboard)
- About five minutes to install the SDK and update your calls
Step 1: Install the AlterLab SDK
You can install the official Python package or call the REST API directly. The SDK mirrors the ScrapingBee client pattern.
```bash title="Terminal — Install AlterLab"
pip install alterlab
For full setup details, see the [Getting started guide](/docs/quickstart/installation).
## Step 2: Replace your API calls
Below is a direct before‑and‑after comparison. The only changes are the import, client initialization, and API key.
```python title="before_scrapingbee.py"
# ScrapingBee (before migration)
from scrapingbee import ScrapingBeeClient
client = ScrapingBeeClient(api_key="YOUR_SCRAPINGBEE_KEY")
response = client.get(
url="https://example.com",
params={"render_js": True}
)
print(response.content)
```python title="after_alterlab.py" {3-7}
AlterLab (after migration)
client = alterlab.Client("YOUR_ALTERLAB_API_KEY")
response = client.scrape(
url="https://example.com",
params={"render_js": True}
)
print(response.text) # Same data, pay‑as‑you‑go pricing
## Step 3: Handle response format differences
AlterLab returns a response object with the same attributes you used with ScrapingBee:
- `response.text` (or `response.content` for bytes)
- `response.status_code`
- `response.headers`
If you accessed `response.json()` on ScrapingBee, note that AlterLab does not auto‑parse JSON; you must `json.loads(response.text)` yourself. Otherwise, the structure is compatible.
## Step 4: Update your error handling
Both services use HTTP status codes to signal issues. AlterLab returns:
- `429` for rate limits (same as ScrapingBee)
- `402` when your balance is insufficient (ScrapingBee uses `403` for auth issues)
- `5xx` for upstream target errors
Adjust any custom retry logic to treat `402` as an out‑of‑balance condition rather than an authentication failure. Otherwise, your existing retry‑on‑`429` logic works unchanged.
## Cost comparison
Consider a workload of 10,000 requests per month.
| Platform | Cost for 10,000 requests | Monthly minimum | Balance expiry |
|----------|--------------------------|-----------------|----------------|
| AlterLab | $2.00 (10,000 × $0.0002) | $0 | Never |
| ScrapingBee | $49.00 (base plan) | $49.00 | Credits expire monthly |
<div data-infographic="stats">
<div data-stat data-value="$0.0002" data-label="Per Request (AlterLab)"></div>
<div data-stat data-value="$0" data-label="Monthly Minimum"></div>
<div data-stat data-value="Never" data-label="Balance Expiry"></div>
</div>
Both APIs are capable — this guide is for developers prioritizing pay‑as‑you‑go pricing and no subscription requirements. See the [AlterLab pricing](/pricing) page for full details.
## Common issues and fixes
- **Missing `render_js` flag** – AlterLab uses smart‑tier routing; you can explicitly set `min_tier=3` for JavaScript sites instead of `render_js`.
- **JSON parsing** – AlterLab returns raw HTML/text by default. Add `params={"format": "json"}` if you need JSON output, then parse `response.text`.
- **Error `402`** – Check your balance in the dashboard or add a balance‑check endpoint before batch jobs.
- **Proxy headers** – If you relied on ScrapingBee’s `proxy_address` header, AlterLab provides equivalent data under `response.headers["X-AlterLab-Proxy"]`.
## You're done
Your migration is complete. Run your test suite to confirm everything works, then deploy. For more advanced options (scheduling, webhooks, Cortex AI), refer to the [full documentation](/docs).
AlterLab // Web Data, Simplified.
Top comments (0)