ProxyScrape Python and Web: How to Fetch, Validate, and Rotate Proxies
ProxyScrape offers downloadable proxy lists and an API, but free lists are not production infrastructure. Here is a safe Python workflow for fetching, validating, and rotating proxies, plus what to check in the web dashboard.
ProxyScrape is often searched together with Python because users want to fetch a proxy list, test it, and rotate it in a script. The web dashboard and the API overlap, but they serve different purposes. This guide focuses on a safe workflow: fetch, validate, rotate, and know when free proxies are the wrong tool.
What You Get from ProxyScrape: Web Lists, API, and Paid Pools
ProxyScrape provides proxy list downloads and API access, along with commercial proxy services. Exact endpoints, protocols, formats, limits, and available locations can change, so always confirm them in your ProxyScrape dashboard or current documentation. Do not hardcode an endpoint you found in an old tutorial without checking it.
Free proxy lists are best for learning and testing. They are usually unsuitable for production scraping, logins, or any sensitive data because uptime, speed, and trustworthiness vary widely.
Fetching a Proxy List in Python
Start by storing the API URL in an environment variable rather than committing it to your code.
import os
import requests
API_URL = os.environ['PROXYSCRAPE_API_URL'] # copy from your ProxyScrape dashboard/docs
response = requests.get(API_URL, timeout=15)
response.raise_for_status()
lines = [line.strip() for line in response.text.splitlines() if line.strip()]
print(f'Fetched {len(lines)} proxies')
print(lines[:5])
If the API returns JSON, inspect the response shape before choosing fields. Field names may change.
data = response.json()
# Adjust this to match the current API response
proxies = [item['proxy'] for item in data.get('proxies', [])]
Validating Proxies Before They Waste Your Time
A proxy list is not useful until you test it. Validate against a harmless IP echo endpoint and record which proxies work.
import concurrent.futures
import requests
TEST_URL = 'https://api.ipify.org?format=json'
def check(proxy):
# Use http:// for HTTP proxies.
# For SOCKS5, install requests[socks] and use socks5h://host:port.
proxy_url = f'http://{proxy}'
proxies = {'http': proxy_url, 'https': proxy_url}
try:
response = requests.get(TEST_URL, proxies=proxies, timeout=8)
response.raise_for_status()
return proxy, response.json()
except Exception:
return proxy, None
working = []
with concurrent.futures.ThreadPoolExecutor(max_workers=50) as pool:
for proxy, result in pool.map(check, lines[:200]):
if result:
working.append(proxy)
print('OK', proxy, result)
print(f'Working: {len(working)}')
For SOCKS5 proxies, use socks5h://host:port when you want remote DNS. For authenticated proxies, the format is usually http://user:pass@host:port or socks5h://user:pass@host:port, but confirm the provider format.
Rotating Proxies in a Python Script
Once you have a pool of working proxies, rotate them with a predictable strategy. Per-request rotation is easy, but it can break sessions and trigger login checks.
import itertools
import requests
from requests.adapters import HTTPAdapter
working_proxies = working # from the validator above
proxy_cycle = itertools.cycle(working_proxies)
session = requests.Session()
session.mount('https://', HTTPAdapter(max_retries=2))
urls = [
'https://example.com/page/1',
'https://example.com/page/2',
'https://example.com/page/3',
]
for url in urls:
proxy = next(proxy_cycle)
proxies = {
'http': f'http://{proxy}',
'https': f'http://{proxy}',
}
try:
response = session.get(url, proxies=proxies, timeout=12)
print(response.status_code, proxy, url)
except requests.RequestException as exc:
print('FAILED', proxy, exc)
If the target site needs a stable session, use sticky sessions instead of rotating every request. Many providers implement this through a session ID in the username. Check your provider docs for the exact format; do not guess.
Using the ProxyScrape Web Dashboard
The web side is useful for quick checks:
- Download a list in the format you need.
- Filter by protocol, such as HTTP or SOCKS5, if available.
- Filter by country or anonymity level if available.
- Copy the API endpoint for automation.
- Check whether the list is free or tied to a paid plan.
- Confirm that the target site allows the type of access you plan.
If a downloaded list is stale within minutes, that is normal for free proxies. Treat it as disposable.
Ethics, Safety, and Legal Checks
- Respect the target site's terms, robots.txt, and rate limits.
- Do not send credentials, personal data, or payment data through untrusted free proxies.
- Use TLS and verify certificates.
- If you process personal data, check GDPR, CCPA, and other applicable rules.
- Use paid residential or datacenter proxies when you need reliability and support.
Takeaway
ProxyScrape can be used from both the web dashboard and Python, but the workflow matters more than the source. Fetch the current list, validate it, rotate with a purpose, and keep free proxies where they belong: in testing and learning.