Scrapling is a Python framework for fetching, parsing and crawling web pages, with an MCP server for AI agents. Configure a gateway URL with proxy, or attach a ProxyRotator through a session’s proxy_rotator argument. This tutorial covers version 0.5.2 across HTTP requests, Chromium sessions, spiders and MCP calls, with observed outputs and session limits. Official package overview.
The December 2, 2026 routing snapshot covers public IP endpoints and a practice scraping site. It demonstrates request routing and extraction, without establishing throughput or access to protected sites.
Key Facts
- The December 2, 2026 routing snapshot used Scrapling 0.5.2 on Ubuntu 24.04 with Python 3.12.3.
- HTTP rotation worked with a session-level proxy rotator.
- The HTTP sticky check returned the same exit IP across three requests.
- The browser flow retained one observed IP while extracting 10 JavaScript-rendered quotes.
- The MCP server listed 17 tools and returned HTTP 200 through a proxied target request.
- The spider collected 100 items across 10 recorded requests in 17.1 seconds.
What Does Scrapling Do?
Scrapling combines page retrieval, extraction and crawling. Its MCP server exposes scraping tools to compatible AI clients. Package description.
Choose the Right Fetcher
- HTTP: use
Fetcher,AsyncFetcherorFetcherSessionwhen the response contains the required data. HTTP documentation. - JavaScript: use
StealthyFetcher,StealthySessionorAsyncStealthySessionfor browser rendering. Browser documentation. - Existing browser: use
RemoteSessionorAsyncRemoteSessionfor CDP connections, with separate remote-browser routing. CDP migration guide.
Adaptive parsing uses stored element information to relocate elements after markup changes. Validate extracted values: a similar element may represent a different field. Adaptive parsing documentation.
DynamicFetcher was removed in version 0.5. Replace dynamic classes with their stealthy equivalents and move cdp_url connections to remote sessions. Migration instructions.
How Do You Install the Tested Version?
Install Scrapling 0.5.2 with fetching and AI extras in a virtual environment:
python3.12 -m venv venv
venv/bin/python -m pip install "scrapling[fetchers,ai]==0.5.2"
venv/bin/python -m patchright install chromium
venv/bin/python -m pip freeze > versions.txt
This command pins Scrapling only; dependencies may resolve to newer versions. Version-specific dependency metadata.
Tested on December 2, 2026 with Ubuntu 24.04, Python 3.12.3, curl_cffi 0.17.0, Patchright 1.64.4, Playwright 1.65.3, MCP 2.3.0 and Chrome Headless Shell 156.0.8078.4. The browser download command does not install missing operating-system libraries.
Save the HTTP, browser, MCP and spider examples as t1_fetcher.py, t2_stealthy.py, t3_mcp.py and t4_spider.py. Run each with venv/bin/python filename.py from the directory containing venv; activation is unnecessary. Python virtual environments.
Inject DI_USER and DI_PASS through your execution environment. Keep credentials out of logs and source control. Consult the official repository and changelog before upgrading.
Scrapling Proxy Setup and Verification
The route-country-state check: compare baseline and gateway IPs, inspect the reported country, then check exit continuity and browser state separately.
Compare the gateway requests with a baseline made without a proxy argument. Scrapling’s HTTP backend is curl_cffi, which also honors proxy environment variables, so clear them for the baseline as shown below (curl_cffi session defaults).
The gateway is gw.dataimpulse.com:823. Plain LOGIN uses rotating connections; LOGIN__cr.us selects the US. Country targeting is included in the standard residential rate. City, state, ZIP and ASN targeting cost twice that rate. Residential plans and targeting charges.
For a sticky exit, add a session ID: LOGIN__cr.us;sessid.NAME keeps the same IP for about 30 minutes on average (session-ID reference). Port-based sticky connections support intervals of 1 to 120 minutes (connection types). Residential exits are real devices, so an exit can change earlier if its peer disconnects (why sticky sessions drop).
HTTP Fetcher and Session
Run the HTTP script with inherited proxy settings removed:
env -u http_proxy -u HTTP_PROXY -u https_proxy -u HTTPS_PROXY \
-u all_proxy -u ALL_PROXY -u no_proxy -u NO_PROXY \
venv/bin/python t1_fetcher.py
# Scrapling 0.5.2 Fetcher + DataImpulse gateway test. Creds from env, never printed.
import os, json, datetime
from scrapling.fetchers import Fetcher, FetcherSession, ProxyRotator
U, P = os.environ["DI_USER"], os.environ["DI_PASS"]
GW = "gw.dataimpulse.com:823"
def ip(page): return page.json()["ip"] if hasattr(page,"json") else json.loads(page.body)["ip"]
d = Fetcher.get("https://api.ipify.org?format=json")
print("1 direct", d.status, ip(d))
# 2 rotating: plain login -> new exit IP per request (new connection)
for i in range(3):
p = Fetcher.get("https://api.ipify.org?format=json", proxy=f"http://{U}:{P}@{GW}")
print("2 rotating", i, p.status, ip(p))
# 3 country targeting __cr.de in the login
p = Fetcher.get("https://ipinfo.io/json", proxy=f"http://{U}__cr.de:{P}@{GW}")
j = p.json(); print("3 country de", p.status, j.get("ip"), j.get("country"))
# 4 sticky session via sessid in login, reused 3 times inside a FetcherSession
with FetcherSession(impersonate="chrome", proxy=f"http://{U}__cr.us;sessid.scr1:{P}@{GW}") as s:
print("4 sticky", [ip(s.get("https://api.ipify.org?format=json")) for _ in range(3)])
# 5 ProxyRotator over two sticky sessions
rot = ProxyRotator([f"http://{U}__cr.us;sessid.scra:{P}@{GW}", f"http://{U}__cr.us;sessid.scrb:{P}@{GW}"])
with FetcherSession(proxy_rotator=rot) as s:
for i in range(4):
r = s.get("https://api.ipify.org?format=json"); print("5 rotator", i, r.status, ip(r), r.meta.get("proxy","").split("@")[0].split(";")[-1].split(":")[0])
# 6 real page through proxy
q = Fetcher.get("https://quotes.toscrape.com/", proxy=f"http://{U}:{P}@{GW}")
print("6 quotes", q.status, len(q.css(".quote")), q.css(".quote .author::text").get())
Output (December 2, 2026, 15:32 UTC):
1 direct 200 81.17.103.182 2 rotating 0 200 37.17.144.77 2 rotating 1 200 176.216.99.119 2 rotating 2 200 82.199.216.68 3 country de 200 5.42.207.6 DE 4 sticky ['97.154.200.106', '97.154.200.106', '97.154.200.106'] 5 rotator 0 200 107.127.28.104 sessid.scra 5 rotator 1 200 172.56.1.54 sessid.scrb 5 rotator 2 200 107.127.28.104 sessid.scra 5 rotator 3 200 172.56.1.54 sessid.scrb 6 quotes 200 10 Albert Einstein
The country endpoint reported DE, and three sticky requests returned one address. Your IPs will differ; the pattern should not.
Browser Sessions and Sticky Flows
Browser fetchers accept a proxy URL or a dictionary containing server, username and password. Browser proxy options.
# Scrapling 0.5.2 StealthyFetcher/StealthySession + DataImpulse gateway. Creds from env.
import os, json
from scrapling.fetchers import StealthyFetcher, StealthySession, ProxyRotator
U, P = os.environ["DI_USER"], os.environ["DI_PASS"]
GW = "gw.dataimpulse.com:823"
# 1 one-off stealth fetch, proxy as dict (Playwright style)
page = StealthyFetcher.fetch("https://api.ipify.org?format=json",
proxy={"server": f"http://{GW}", "username": f"{U}__cr.us", "password": P}, headless=True)
print("1 stealthy dict proxy", page.status, page.get_all_text(strip=True)[:60])
# 2 session with sticky proxy string: same IP across pages, JS-rendered quotes
with StealthySession(headless=True, proxy=f"http://{U}__cr.us;sessid.stl1:{P}@{GW}") as s:
a = s.fetch("https://api.ipify.org?format=json").get_all_text(strip=True)
q = s.fetch("https://quotes.toscrape.com/js/", wait_selector=".quote")
b = s.fetch("https://api.ipify.org?format=json").get_all_text(strip=True)
print("2 sticky session", a, b, "js quotes:", len(q.css(".quote")))
# 3 rotator in a browser session: each fetch gets its own context + proxy
rot = ProxyRotator([f"http://{U}__cr.us;sessid.stla:{P}@{GW}", f"http://{U}__cr.gb;sessid.stlb:{P}@{GW}"])
with StealthySession(headless=True, proxy_rotator=rot) as s:
for i in range(2):
print("3 rotator", i, s.fetch("https://ipinfo.io/json").get_all_text(strip=True)[:90])
Output (same run):
1 stealthy dict proxy 200 {"ip":"97.180.27.195"}
2 sticky session {"ip":"172.56.99.139"} {"ip":"172.56.99.139"} js quotes: 10
Browser rotation summary condensed from the IP endpoint’s JSON, not raw stdout:
3 rotator 0 -> ip 172.59.98.58, Milwaukee, Wisconsin, US 3 rotator 1 -> ip 185.108.132.85, GB
The sticky session kept one exit across three page loads, and the rotator gave each fetch its own context and exit (US, then GB).

How Does Gateway Rotation Differ From ProxyRotator?
A rotating gateway changes exits behind one address. ProxyRotator selects among supplied proxy URLs, cyclically by default. Rotation API.
Attach proxy_rotator to the session. Do not combine it with proxy or proxies in the constructor. A per-request proxy string overrides rotation for that call. Request overrides.
Without a rotator, a browser session uses a persistent context. With rotation, each fetch receives a separate context that closes afterward. A repeated exit cannot restore cookies from a closed context. Use one browser session and a fixed sticky proxy for permitted multi-step flows. Browser context behavior.
How Do You Configure a Scrapling Spider?
Configure the proxy on the spider’s session, enable robots handling and throttling, and choose concurrency appropriate to the target.
# Scrapling 0.5.2 Spider: polite crawl of quotes.toscrape.com through rotating DataImpulse exits.
import os
from scrapling.spiders import Spider, Response
from scrapling.fetchers import FetcherSession
U, P = os.environ["DI_USER"], os.environ["DI_PASS"]
class QuotesSpider(Spider):
name = "quotes"
start_urls = ["https://quotes.toscrape.com/"]
allowed_domains = {"quotes.toscrape.com"}
concurrent_requests = 4
robots_txt_obey = True
autothrottle_enabled = True
def configure_sessions(self, manager):
manager.add("default", FetcherSession(impersonate="chrome",
proxy=f"http://{U}__cr.us:{P}@gw.dataimpulse.com:823"))
async def parse(self, response: Response):
for q in response.css(".quote"):
yield {"text": q.css(".text::text").get(), "author": q.css(".author::text").get()}
nxt = response.css(".next a::attr(href)").get()
if nxt:
yield response.follow(nxt)
result = QuotesSpider().start()
print("items", len(result.items), "first", result.items[0]["author"] if result.items else None)
result.items.to_json("quotes.json")
This recorded example retains up to three automatic blocked-response retries, including for 401, 403 and 429. A rotating gateway may use another exit on retry. Before adapting it to another site, set max_blocked_retries = 0 on the spider, investigate refusals and implement that site’s retry policy. Do not change exits to continue past a denial or rate limit. Pinned defaults and retry scheduling.
Condensed summary of the recorded spider output and statistics, not raw stdout. The final print statement produced items 100 first Albert Einstein; the remaining figures summarize crawl statistics and timing.
items 100 first Albert Einstein; stats requests_count 10, failed 0, blocked 0, robots_disallowed 0; wall time 17.1 s (requests_per_second 0.61).
Zero blocked responses provides no evidence of blocked-response recovery. HTTP transport retries and spider blocked-response retries have separate handling. HTTP implementation.
HTTP 429 can include Retry-After. RFC 6585 Section 4. In 0.5.2, AutoThrottle uses that header for unsuccessful responses when autothrottle_block_backoff is enabled, as it is by default. The default autothrottle_max_delay of 60 seconds can truncate longer waits. Pause new requests to that target for the full requested interval; throttling does not retrospectively pause requests already running. Throttle implementation and response handling.
How Do You Connect Scrapling MCP?
Install the [ai] extra and launch venv/bin/scrapling-mcp for stdio transport. The target-fetch proxy is a tool argument, separate from the client-server connection. MCP setup.
For Claude Code, register the executable with claude mcp add scrapling -- /absolute/path/to/venv/bin/scrapling-mcp, replacing the path. Stdio registration syntax.
# Start scrapling-mcp over stdio, list tools, call make_request through the DataImpulse gateway.
import asyncio, os, json
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
U, P = os.environ["DI_USER"], os.environ["DI_PASS"]
async def main():
params = StdioServerParameters(command=os.path.abspath("venv/bin/scrapling-mcp"), args=[])
async with stdio_client(params) as (r, w):
async with ClientSession(r, w) as s:
await s.initialize()
tools = (await s.list_tools()).tools
print("tools", len(tools), sorted(t.name for t in tools))
mr = [t for t in tools if t.name == "make_request"][0]
print("make_request params", sorted(mr.input_schema.get("properties", {}).keys()))
res = await s.call_tool("make_request", {"url": "https://api.ipify.org?format=json",
"proxy": f"http://{U}__cr.us:{P}@gw.dataimpulse.com:823"})
txt = " ".join(getattr(c, "text", "") for c in res.content)
print("make_request via proxy ->", txt[:300])
asyncio.run(main())
Recorded tool-list, schema and response excerpts:
tools 17 ['browser_actions', 'browser_evaluate', 'browser_extract', 'browser_fetch', 'browser_fetch_once', 'browser_load_state', 'browser_network_request', 'browser_network_requests', 'browser_observe', 'browser_open', 'browser_save_state', 'browser_screenshot', 'close_session', 'list_sessions', 'make_request', 'open_request_session', 'session_make_request']
make_request params ['auth', 'cookies', 'css_selector', 'data', 'extraction_type', 'follow_redirects', 'headers', 'http3', 'impersonate', 'json', 'main_content_only', 'max_redirects', 'method', 'params', 'proxy', 'proxy_auth', 'retries', 'retry_delay', 'stealthy_headers', 'timeout', 'url', 'verify']
make_request via proxy -> {"status": 200, "content": ["{\"ip\":\"172.59.25.223\"}", ""], "url": "https://api.ipify.org/?format=json"}
Inspect the connected server’s schema before calling tools. This example uses MCP 2.3.0’s input_schema attribute; make_request accepts a per-call proxy. Tool reference.
For authenticated HTTP transport, set SCRAPLING_MCP_AUTH_TOKEN securely and launch venv/bin/scrapling-mcp --http. Clients send the token with the Bearer scheme in the Authorization header. Authentication instructions.
Which Traffic Does the Proxy Control?
These settings control target retrieval, without establishing machine-wide routing or changing model connections.
| Traffic | Routing Control |
|---|---|
| HTTP fetches | Request proxy, session proxy, or session proxy_rotator |
| Chromium page traffic | Browser proxy configuration; inspect contexts and subresources |
| Spider requests | Configured session and request overrides |
| MCP target fetch | Tool-specific proxy input |
| Model API, built-in search, unrelated shell commands | Separate client configuration |
| Remote CDP browser | Separate remote-browser routing |
See the HTTP options, browser configuration and MCP arguments. An IP response establishes the observed route for that request only.
How Do You Troubleshoot Routing and Failures?
Common Mistakes in 0.5.2
Both Fetcher.get(url, proxy_rotator=rot) and FetcherSession(proxy=rot) raised TypeError. Use FetcherSession(proxy_rotator=rot) or StealthySession(proxy_rotator=rot). Replace removed DynamicFetcher imports using the migration guide.
| Symptom | Check | Meaning | Fix |
|---|---|---|---|
| 407 | Proxy error detail, credentials, traffic balance, connection limit and plan restrictions | HTTP proxy authentication status; DataImpulse also uses it for quota and plan failures | Correct credentials for authentication failures; restore traffic for TRAFFIC_EXHAUSTED; reduce concurrent connections for THREADS_EXHAUSTED; resolve port or plan restrictions before retrying |
| Certificate error | Certificate chain and backend trust | TLS trust failed | Repair trust configuration |
| Unchanged IP | Baseline environment, sticky suffix and connection reuse | IP equality alone is inconclusive | Repeat isolated baseline and explicit-proxy checks |
| Timeout | Gateway, destination and timeout stage | Deadline exceeded | Separate connection failure from page loading |
| Browser launch failure | Binary, libraries and sandbox configuration | Browser startup failed | Repair installation or runtime configuration |
| MCP error | Executable and tool schema | Setup or argument mismatch | Use the installed executable and listed arguments |
| 429 | Retry-After and concurrency |
Target requests slower traffic | Pause requests and reduce load |
Interpret 407 using both HTTP semantics and the DataImpulse error detail. Keep diagnostic records credential-free.
What Are the Limits, Alternatives and Costs?
Choose a library around retrieval and extraction needs:
| Library | Typical Fit |
|---|---|
| Scrapling | Integrated fetching, parsing and spiders. Overview |
| Requests and BeautifulSoup | HTTP retrieval and HTML parsing |
| Scrapy | Established crawler pipelines |
curl_cffi |
HTTP browser fingerprints. Documentation; TLS background |
| Playwright | Explicit browser automation |
| Puppeteer Real Browser | Puppeteer integration. Setup guide |
| Crawl4AI | Crawling into Markdown |
| Camoufox | Firefox-based automation. Proxy setup |
| nodriver | Browser automation through CDP. Proxy setup |
| Botasaurus | Decorator-based scraping. Integration overview |
Descriptions are based on each project’s official repository and documentation, collected December 2, 2026. DataImpulse sells proxies; we do not sell or maintain any of these libraries.
Scrapling’s BSD-3-Clause license does not eliminate compute, browser or network costs. License metadata. DataImpulse residential proxies start from $1/GB with country targeting included. Residential pricing. City, state, ZIP and ASN targeting cost twice the standard rate. Budget for targeting, transferred traffic and retries. Target-filter billing.
Use proxies for country-specific public content and permitted browsing flows. The routing snapshot establishes no protected-site success rate. See the browser documentation, Cloudflare context and limits of stealth claims.
Assess collection requirements using our scraping legality guide. Respect access policies and rate limits. The robots.txt protocol expresses crawler policy without granting access authorization. RFC 9309.
Frequently Asked Questions
What is Scrapling?
Scrapling is a Python library for retrieving pages, extracting content and running crawlers. Its MCP server exposes scraping operations to compatible AI clients.
Can I pass ProxyRotator directly to Fetcher.get?
That pattern raises TypeError in Scrapling 0.5.2. Attach the rotator using FetcherSession(proxy_rotator=rot).
Does a sticky proxy preserve browser cookies?
Exit addresses and browser state are separate. Keep the same browser context for a multi-step flow; repeating a sticky URL does not restore cookies from a closed context.
Which fetcher should I use for JavaScript?
Use StealthyFetcher or a stealthy session. The browser example waits for .quote and extracts ten rendered quotes.
Does the MCP proxy also route model requests?
No. The proxy argument controls target retrieval for that tool call. Configure model traffic and other client connections separately.
What should a successful routing check show?
Remove inherited proxy settings before comparing the baseline with an explicit gateway request. Inspect exit IP, country and sticky behavior separately. An unchanged IP needs diagnosis; historical addresses need not recur.
Do these results establish performance on protected sites?
No. The observations cover public diagnostic endpoints and a practice scraping site. They establish no challenge-handling or bypass success rate.
Start With One Observable Proxy Request
Connect DataImpulse through the proxy settings above. Confirm the exit, country and extracted content before expanding the crawl, then measure traffic against your budget.
Last updated: December 2, 2026.
