Skip the rotator you were about to build
Home-grown rotation, a proxy list behind a local manager, a container on AWS juggling addresses, needs you to find IPs, test them, drop the dead ones and balance threads. A backconnect pool does all of that on its side: your scraper keeps one HOST:PORT and gets a fresh IP per request.
A retry pattern that rotates
import requests, time
PROXY = "http://USER:PASS@HOST:PORT" # a rotating list
proxies = {"http": PROXY, "https": PROXY}
def fetch(url, tries=4):
for n in range(tries):
r = requests.get(url, proxies=proxies, timeout=30)
if r.status_code not in (403, 429):
return r
time.sleep(2 ** n) # the next try leaves from another IP
return rWhich pool for which target
- Public APIs and tolerant sites: datacenter, the cheapest per GB.
- Marketplaces, search engines, anti-bot sites: rotating residential.
- Mobile app APIs: mobile.
Spread concurrency instead of bursting, use sticky lists for paginated sessions, and keep to public data and each site's capacity.