Skip to main content

Package for fetching and validating working HTTP/HTTPS proxies from multiple sources

Project description

Proxy Fetcher (Enhanced)

Python package for fetching and validating HTTP/HTTPS proxies from multiple sources with asynchronous support and custom validation. Features

Asynchronous validation for high-performance proxy checking

Custom URL testing - verify proxies against specific websites

Advanced validation with custom response validators

User-Agent customization to avoid blocking

Multiple proxy sources (Geonode, ProxyScrape, Free-Proxy.CZ)

Progress tracking with tqdm

Automatic saving of working proxies

Installation bash

pip install proxy-fetcher

Note: Requires Python 3.13 or higher

Quick Start Basic Usage python

from proxy_fetcher import get_proxies

Get 10 working proxies (default)

proxies = get_proxies() print(f"Found {len(proxies)} working proxies")

Custom URL Testing python

Test proxies against a specific website

proxies = get_proxies( custom_url="https://www.google.com/finance/quote/AED-KZT", timeout=8 )

Advanced Validation python

def custom_validator(response, content): # Validate response content return "AED-KZT" in content and response.status == 200

proxies = get_proxies( custom_url="https://www.google.com/finance/quote/AED-KZT", custom_validator=custom_validator, user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" )

Performance Tuning python

proxies = get_proxies( CONCURRENT_CHECKS=200, # Parallel checks (default: 100) TIMEOUT=3, # Shorter timeout for faster results PROXY_LIMIT=500, # More proxies to test MAX_ATTEMPTS=5 # More attempts to find proxies )

Configuration Options Parameter Default Description MIN_WORKING_PROXIES 10 Minimum working proxies to find PROXY_LIMIT 100 Max proxies to fetch per attempt TIMEOUT 5 Timeout for proxy validation (seconds) MAX_ATTEMPTS 3 Max attempts to reach target count CONCURRENT_CHECKS 100 Number of concurrent proxy checks (increase for speed) TEST_URLS Standard list Default URLs for proxy validation CUSTOM_TEST_URL None Specific URL to test proxies against (overrides TEST_URLS) CUSTOM_VALIDATOR None Custom function to validate proxy response (see example) USER_AGENT Modern browser User-Agent header to use for validation requests Advanced Usage Using the ProxyFetcher Class python

from proxy_fetcher import ProxyFetcher

fetcher = ProxyFetcher( MIN_WORKING_PROXIES=5, CUSTOM_TEST_URL="https://example.com", CONCURRENT_CHECKS=250, USER_AGENT="My Custom User Agent" )

if fetcher.fetch_proxies(): print(f"Working proxies: {fetcher.working_proxies}") # Save to custom file with open('my_proxies.txt', 'w') as f: f.write('\n'.join(fetcher.working_proxies))

Custom Validator Examples

For Google Finance: python

def google_finance_validator(response, content): # Check status and content return response.status == 200 and "AED-KZT" in content and "currency exchange rate" in content

For JSON APIs: python

import json

def json_api_validator(response, content): try: data = json.loads(content) return data.get("success") and response.status == 200 except: return False

Proxy Storage Automatic Saving

Working proxies are automatically saved to working_proxies.txt after successful validation. Manual Export python

proxies = get_proxies() with open('custom_proxies.txt', 'w') as f: f.write('\n'.join(proxies))

Loading Proxies python

with open('working_proxies.txt') as f: loaded_proxies = f.read().splitlines()

Performance Tips

Increase concurrency: Set CONCURRENT_CHECKS=200-500 for faster validation

Reduce timeout: Set TIMEOUT=3-5 seconds for public proxies

Custom validation: Implement specific checks for target websites

Use fresh proxies: Public proxies often have short lifespans

Troubleshooting

No proxies found:

    Increase TIMEOUT (10-15 seconds)

    Use simpler TEST_URLS (like http://httpbin.org/ip)

    Increase MAX_ATTEMPTS

Slow validation:

    Increase CONCURRENT_CHECKS

    Reduce PROXY_LIMIT

Blocked by target site:

    Rotate User-Agents

    Add delays between requests

License

MIT Changelog (v0.3.0)

Added asynchronous validation with aiohttp

Implemented custom URL testing

Added support for response validators

Enhanced User-Agent customization

Improved performance with concurrent checks

Updated documentation with Google Finance examples

For support and issues, visit GitHub Repository

Совместимость

Пакет работает с Python 3.11 и выше. Для использования с Python 3.11 установите:

pip install proxy-fetcher==0.3.1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proxy_fetcher-0.3.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

proxy_fetcher-0.3.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file proxy_fetcher-0.3.1.tar.gz.

File metadata

  • Download URL: proxy_fetcher-0.3.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for proxy_fetcher-0.3.1.tar.gz
Algorithm Hash digest
SHA256 2929d0b52e190d68867bb0736f3a104b7ab6d784c0f21fb9892e8913b795803e
MD5 f47c4dd5bb7b486fd9a7c934dd0bbc49
BLAKE2b-256 6e640eda87cf68a89a2a917dae2e5e7b146797a785c89aa05a8139d6c5ba3006

See more details on using hashes here.

File details

Details for the file proxy_fetcher-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: proxy_fetcher-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for proxy_fetcher-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3aa1b017a1d924dd060f69df7df78917b91f681156f31e9e09ce8002c4aa99e3
MD5 c48d4bfadd2bf2be62fb0af96436b03c
BLAKE2b-256 9f3b4e126cfb021c40a7c4012d8cf81d846490e53919b15e120c7f8da03ccd98

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page