Detecting Bans & Graceful Recovery
The Ban Is a Controllable Event
Getting banned is not a failure state—it is an expected, budgeted condition of operating at scale. The professionals differentiate themselves by detecting bans fast, isolating the affected identity, and restarting cleanly instead of compounding damage.
Detecting a Ban Precisely
A wholesale 403 is easy. Real bans are subtler: - Soft block: the site returns 200 but serves a CAPTCHA page or an empty shell with no product data. - Honeypot silent block: the page loads but is laced with decoy links, inflated prices, or duplicated listings. - Rate-limit 429: distinct from a ban; treat with backoff, not identity change. - Session poisoning: cookies that were valid flip to "session expired" repeatedly. - Empty results on high-frequency endpoints: a leading indicator that your requests are being null-rounded.
Detect these by validating content, not just status codes: assert the presence of expected DOM landmarks or JSON keys before trusting a 200.
The Recovery Sequence
When a ban is detected: 1. Freeze the identity (IP + profile). No more requests from that combination; continued hits only escalate the block and can extend its duration. 2. Cool down the IP. Reputation scoring decays over hours; keep the IP idle for a cooldown period before any successor traffic on the same subnet. 3. Requeue the job for a fresh profile/IP, with an exponential backoff on the initial delay. 4. Drain the profile. Mark affected profile as "cooling", let legacy cookies expire naturally, and stop reusing its clearance tokens.
Backoff Algebra
The classic pattern is exponential backoff with full jitter: for retry n, sleep random(0, min(cap, base * 2^n)). With a background of distributed-queue leases, the targeted cap keeps recovery request rates from peaking when many workers recover simultaneously.
import random
import time
def backoff(n, base=5.0, cap=300.0):
return random.uniform(0, min(cap, base * 2 ** n))
for attempt in range(6):
ok = try_request()
if ok:
break
time.sleep(backoff(attempt))
Cooldown and Warm Return
IPs and profiles do not recover instantly. Re-introduce a cooled identity via low-risk traffic: a homepage visit, one detail page, a slow crawl at a tenth of the normal rate. If the recovered identity is re-rejected within the first minute, the block has not lifted—cool it again. Going hot too fast after a ban is how "cooled" operations get permanently blacklisted.
The Cost Model
Every ban has a price: the IP, the profile, the CLV of that identity, and the retry cost. Model bans as a line item, tune your request rate and proxy mix to keep the ban rate under a budgetary threshold, and stop optimizing for raw speed when diminishing returns push ban rates through the roof. The fleet that survives for months is the one that treats burn rate as a first-class metric.
Prefer Prevention to Recovery
The cheapest ban is the one that never happens. Because reputation decays and accounts age, prevention beats recovery by a wide margin: run below the tolerance threshold, warm profiles before high-volume jobs, and retire a profile at the first sign of soft-blocking rather than waiting for a hard ban. Recovery is the fallback when prevention fails, not the primary strategy.
Document the Ban Playbook
Write down, per target, what a ban looks like, which recovery step works, and what triggered it. Targets differ: one responds to cooldowns, another to new profiles, another to a rate drop. Encoding that institutional knowledge as an automated playbook means an on-call engineer does not have to rediscover it during an incident at 3 a.m.