Skip to main content

Rotating Proxy

GitHub Release PyPI Downloads

A Python package for managing and utilizing rotating proxies effectively. This module provides a simple and efficient way to handle multiple proxies, automatically switching between them to enhance web scraping or any HTTP requests that require anonymity.

Features

  • Proxy Pool Management: Easily add, remove, and manage a list of proxies.
  • Automatic Proxy Rotation: Automatically rotates through working proxies to ensure seamless web requests.
  • Proxy Testing: Verifies the functionality of each proxy before use, maintaining a blacklist of failed proxies.
  • Support for HTTP and SOCKS proxies: Works with different types of proxies to meet your needs.
  • Advanced Proxy Metrics: Track proxy performance with detailed success and failure metrics.
  • Proxy Authentication: Support for authenticated proxies
  • Background Health Checks: Periodic validation of proxy health
  • Exponential Backoff: Intelligent retry mechanism for network requests
  • Dynamic Test URL: Ability to change proxy validation URL

Requirements

  • Python 3.9+
  • Dependencies:
    • requests
    • typing
    • python-dateutil
    • urllib3
    • dataclasses (for Python < 3.7)

Installation

You can install the package using pip:

pip install rotating-proxy

Usage

from rotating_proxy import ProxyPool, ProxySession

class Project:
    def __init__(self):
        # Initialize the proxy pool with proxies, including authentication support
        self.proxy_pool = ProxyPool([
            "http://username:password@proxy1:port",
            "http://proxy2:port"
        ])
        
        # Optional: Change test URL for proxy validation
        self.proxy_pool.change_test_url('https://api.ipify.org')
        
        # Filter and validate working proxies
        self.proxy_pool.filter_working_proxies()

        # Create proxy session with custom configuration
        self.proxy_session = ProxySession(
            self.proxy_pool, 
            timeout=15, 
            max_retries=3,
            default_headers={'User-Agent': 'MyCustomUserAgent'}
        )

    def request_function(self, **kwargs):
        try:
            response = self.proxy_session.request(**kwargs)   
            print(f"IP Address: {response.json()['origin']}")
            
            # Get proxy performance metrics
            metrics = self.proxy_session.get_proxy_performance()
            print(f"Proxy Performance: {metrics}")
        except Exception as e:
            print(f"Request failed: {e}")

if __name__ == "__main__":
    project = Project()
    project.request_function(url="https://httpbin.org/ip", method="GET")

Advanced Features

Proxy Metrics

The ProxyMetrics class tracks detailed information about each proxy:

  • Success and failure counts
  • Last used and last successful timestamps
  • Proxy score
  • Consecutive failures

Customization

  • Configurable timeout and retry settings
  • SSL verification options
  • Logging for tracking proxy performance

Contributing

Contributions are welcome! If you have suggestions for improvements or additional features, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Recent Updates

  • Added support for advanced proxy metrics
  • Improved dependency management
  • Enhanced error handling and logging
  • Expanded Python version compatibility

Metadata

Release files for rotating-proxy 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rotating-proxy 0.3.2
File Size Uploaded Provenance Actions
rotating_proxy-0.3.2.tar.gz 10.3 kB With provenance Details for rotating_proxy-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rotating-proxy 0.3.2
File Interpreter ABI Platform Actions
rotating_proxy-0.3.2-py3-none-any.whl Python 3 none any Details for rotating_proxy-0.3.2-py3-none-any.whl

Total release size: 19.3 kB

Release files / rotating_proxy-0.3.2.tar.gz

Download URL rotating_proxy-0.3.2.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b04e8cfe5db88e16d05623fb05b0828ad6fec495707cfbdc016c7d92ab775130
BLAKE2b-256 checksum
How to use checksums
54c12578208dd085264226d742de4c3b001be10396ac05bd46564aa2abe7a734
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 20, 2025.

Transparency log

Release files / rotating_proxy-0.3.2-py3-none-any.whl

Download URL rotating_proxy-0.3.2-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fd38bdcb7bd02dea61a249624db406a49d2f6d239e32d0eedfad4218a17aa76
BLAKE2b-256 checksum
How to use checksums
4a3385c901c978c7102357b503fcf0696a3a72ea210c9582d1fc8cd74b76e67b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 20, 2025.

Transparency log

Security for rotating-proxy 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rotating_proxy-0.3.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 20, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page