How to Migrate from WebScrapingAPI to AlterLab: Step-by-Step Guide (2026)
Tutorials

How to Migrate from WebScrapingAPI to AlterLab: Step-by-Step Guide (2026)

Learn how to migrate from WebScrapingAPI to AlterLab in under an hour with pay-as-you-go pricing, no subscription, and minimal code changes.

3 min read
12 views

AlterLab handles this automaticallyscrape any URL with one API call. No infrastructure required.

Try it free

TL;DR

To migrate from WebScrapingAPI to AlterLab, install the AlterLab SDK, replace your API key and client initialization, and keep the same request structure. The response format is nearly identical, so your existing scraping logic works with minimal changes. Both APIs are capable, this guide is for developers prioritizing pay-as-you-go pricing and no subscription requirements.

Why migrate?

WebScrapingAPI offers monthly subscription plans where request credits reset at the end of each billing cycle. If your usage varies, you may pay for unused credits or face overage charges. AlterLab provides a pure pay‑as‑you‑go model: you pay only for the requests you make, your balance never expires, and there are no subscription minimums.

Prerequisites

  • An AlterLab account (create one at free sign-up)
  • Your AlterLab API key (found in the dashboard)
  • About five minutes to update your code

Step 1: Install the AlterLab SDK

If you prefer using the official Python SDK, install it with pip. You can also call the REST endpoint directly; the SDK simply wraps the same HTTP calls.

Bash
pip install alterlab

For full setup details, see the Getting started guide.

Step 2: Replace your API calls

Below is a side‑by‑side comparison of a typical WebScrapingAPI request and the equivalent AlterLab call. The parameters (url, render_js, etc.) map directly; only the client initialization and endpoint change.

Python
import requests

WEBSRAPINGAPI_KEY = "your_webscrapingapi_key"
target_url = "https://example.com"

response = requests.get(
    "https://api.webscrapingapi.com/v1",
    params={
        "api_key": WEBSRAPINGAPI_KEY,
        "url": target_url,
        "render_js": 1,
    },
)
html = response.text
Python
import alterlab

# Initialize the AlterLab client with your API key
client = alterlab.Client("YOUR_ALTERLAB_API_KEY")

# Scrape the same target_url and render_js are passed through the SDK – parameters are passed as keyword arguments
response = client.scrape(
    url="https://example.com",
    render_js=True,
)
html = response.text  # Same HTML output as before

If you are not using the SDK, the raw HTTP request looks like this:

Python
import requests

ALTERLAB_KEY = "your_alterlab_api_key"
target_url = "https://example.com"

response = requests.get(
    "https://api.alterlab.io/v1/scrape",
    params={
        "api_key": ALTERLAB_KEY,
        "url": target_url,
        "render_js": true,
    },
)
html = response.text

Step 3: Handle response format differences

AlterLab returns a JSON object with the same top‑level fields you expect from WebScrapingAPI: status, content_type, size, and body (or text when using the SDK). The SDK’s response.text property gives you the raw HTML string directly, matching the .text attribute you used with requests. No parsing changes are required unless you accessed nested metadata fields; in that case, compare the JSON schemas in the API reference.

Step 4: Update your error handling

Both APIs use standard HTTP status codes. AlterLab returns 429 when you exceed your rate limit (based on your account tier) and 402 when your balance is insufficient. If you already implement retry logic for 429 or check for 401/403, you can keep it unchanged. The only difference is that AlterLab does not return a 403 for expired subscription credits – instead you see 402 when the balance hits zero.

Cost comparison

Consider a steady workload of 10,000 requests per month.

  • AlterLab: 10,000 × $0.0002 = $2.00. No monthly fee, and any unused balance stays in your account indefinitely.
  • WebScrapingAPI: Typically requires a subscription tier
Share

Was this article helpful?

Frequently Asked Questions

Typically under an hour. Most existing scraping code remains unchanged; you only need to update the API key and client library.
Yes. The REST API endpoint and response structure are similar, and the Python SDK drop-in replacement requires only a few line changes.
AlterLab charges $0.0002 per request with no monthly minimum and no balance expiry. WebScrapingAPI uses subscription plans with credits that reset each billing cycle.