BeautifulSoup Integration

Python requests + BeautifulSoup + residential proxies: scrape without getting blocked

Add BytesFlows proxy to your requests.Session() in three lines of Python. Every request exits through a different residential IP — preventing rate limiting and IP bans on your BS4 scraping scripts.

Python requests + BeautifulSoup proxy examples

BytesFlows works directly with the requests library — no extra dependencies needed.

basic_proxy.py
import requests
from bs4 import BeautifulSoup

proxies = {
    'http': 'http://YOUR_USER:YOUR_PASS@p1.bytesflows.com:8001',
    'https': 'http://YOUR_USER:YOUR_PASS@p1.bytesflows.com:8001',
}

response = requests.get(
    'https://httpbin.org/ip',
    proxies=proxies,
    timeout=15,
)
print('Exit IP:', response.json()['origin'])

# Use BeautifulSoup to parse any HTML page through proxy
response = requests.get(
    'https://example.com/products',
    proxies=proxies,
    headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'},
)
soup = BeautifulSoup(response.text, 'html.parser')
products = soup.find_all('div', class_='product-card')
print(f'Found {len(products)} products')

Pass the proxies dict to any requests call. For HTTPS sites, both http and https keys must be set even when using HTTP proxy protocol.

Why Python scrapers use BytesFlows with BeautifulSoup

1

Zero extra dependencies

The proxies parameter is built into the requests library. No proxy middleware packages, no special wrappers — just pass a dict with proxy URLs and you're done.

2

Rotating mode by default

BytesFlows rotates the exit IP on each new TCP connection. requests.get() calls each get a fresh residential IP — perfect for scraping large product catalogs or SERP pages where per-URL IP diversity is critical.

3

Works with httpx and aiohttp

Same proxy URL format works with modern async libraries. Use BytesFlows with httpx for async scraping, or aiohttp for high-concurrency data collection — same credentials, same rotating residential IPs.

Python proxy scraping FAQ

How do I use BytesFlows with httpx for async scraping?
httpx accepts the same proxy URL format as requests. Pass proxy URL to httpx.AsyncClient(proxy="http://user:pass@p1.bytesflows.com:8001"). For concurrent requests, use async with httpx.AsyncClient(proxy=...) as client: and asyncio.gather() for multiple async fetches.
How do I handle 407 Proxy Authentication Required errors?
A 407 error means credentials were rejected. Verify the username and password from your BytesFlows dashboard. Ensure special characters in passwords are URL-encoded (use urllib.parse.quote(password, safe="")). Also check your account has active residential traffic balance.
Does BeautifulSoup itself need any proxy configuration?
No. BeautifulSoup only parses HTML — it doesn't make network requests. All proxy configuration is in the requests call that fetches the HTML. BeautifulSoup receives the response text and parses it locally.

Stop getting blocked — route your Python scrapers through residential IPs

1 GB free to test your BeautifulSoup and requests scripts.