Skip to main content

A Python package for managing and using rotating proxies

Project description

Rotating Proxy

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.

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 a list of proxies.
        # Replace "127.0.0.1:80" with your own proxies in the format:
        # [{"http":"proxy1"},{"http":"proxy2"},...{"http":"proxyN"}]
        self.proxy_pool = ProxyPool([{"http":"127.0.0.1:80"}])
        self.proxy_pool.filter_working_proxies()

        self.proxy_session = ProxySession(self.proxy_pool)

    def request_function(self, **kwargs):
        try:
            response = self.proxy_session.request(**kwargs)   
            print(f"IP Address: {response.json()['origin']}")
        except Exception as e:
            print(f"An error occurred: {str(e)}")

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

Contributing

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

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

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

rotating_proxy-0.1.5.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

rotating_proxy-0.1.5-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file rotating_proxy-0.1.5.tar.gz.

File metadata

  • Download URL: rotating_proxy-0.1.5.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.9

File hashes

Hashes for rotating_proxy-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b1d8ed3d4c9eb80b826d2aba742c4bf51c8ed026b6b7db26e1165268db1cd08f
MD5 fe6fa34e0db13fea8a496375a484795a
BLAKE2b-256 d5a218bbdc2c6bd1e9ec5cd961617ac6265defc77494832a206ba1bceb0ccc91

See more details on using hashes here.

File details

Details for the file rotating_proxy-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for rotating_proxy-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1bf51aedf1e5d31e704a3592c198c73ed49fe386724183c4982eba49a2874d85
MD5 9dee06d2cd96b2c42152c7afed813594
BLAKE2b-256 119f56d592520d51f833cc9a93b18cde2b8a678788f0c3a15cbeb66943537985

See more details on using hashes here.

Supported by

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