# Rotating Proxy
![PyPI Downloads](https://static.pepy.tech/badge/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:
```bash
pip install rotating-proxy
```
## Usage
```python
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="https://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.
Raw data
{
"_id": null,
"home_page": "https://github.com/Will6855/rotating-proxy",
"name": "rotating-proxy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Will",
"author_email": null,
"download_url": null,
"platform": null,
"description": "# Rotating Proxy\r\n![PyPI Downloads](https://static.pepy.tech/badge/rotating-proxy)\r\n\r\nA 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.\r\n## Features\r\n\r\n- Proxy Pool Management: Easily add, remove, and manage a list of proxies.\r\n- Automatic Proxy Rotation: Automatically rotates through working proxies to ensure seamless web requests.\r\n- Proxy Testing: Verifies the functionality of each proxy before use, maintaining a blacklist of failed proxies.\r\n- Support for HTTP and SOCKS proxies: Works with different types of proxies to meet your needs.\r\n\r\n## Installation\r\n\r\nYou can install the package using pip:\r\n\r\n```bash\r\npip install rotating-proxy\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nfrom rotating_proxy import ProxyPool, ProxySession\r\n\r\nclass Project:\r\n def __init__(self):\r\n # Initialize the proxy pool with a list of proxies.\r\n # Replace \"127.0.0.1:80\" with your own proxies in the format:\r\n # [\"http://proxy1\",\"http://proxy2\",...\"http://proxyN\"]\r\n self.proxy_pool = ProxyPool([\"http://127.0.0.1:80\"])\r\n self.proxy_pool.filter_working_proxies()\r\n\r\n self.proxy_session = ProxySession(self.proxy_pool)\r\n\r\n def request_function(self, **kwargs):\r\n try:\r\n response = self.proxy_session.request(**kwargs) \r\n print(f\"IP Address: {response.json()['origin']}\")\r\n except Exception as e:\r\n print(f\"An error occurred: {str(e)}\")\r\n\r\nif __name__ == \"__main__\":\r\n project = Project()\r\n project.request_function(url=\"https://httpbin.org/ip\", method=\"GET\")\r\n```\r\n\r\n## Contributing\r\n\r\nContributions are welcome! If you have suggestions for improvements or additional features, feel free to open an issue or submit a pull request.\r\n\r\nThis project is licensed under the MIT License. See the LICENSE file for details.\r\n\r\n\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package for managing and using rotating proxies",
"version": "0.1.6",
"project_urls": {
"Homepage": "https://github.com/Will6855/rotating-proxy"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "76fd561d4e3001acc01540d78d8778494568ba6fa0deb5e2e01b0d3df2808a5f",
"md5": "b08319ce548f47354f373b9d6582f7e1",
"sha256": "62c02ebf9779fda5b5b913b5efc65350eb8ba856dfaae4ff031fb95a8621c793"
},
"downloads": -1,
"filename": "rotating_proxy-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b08319ce548f47354f373b9d6582f7e1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 6186,
"upload_time": "2024-11-11T11:36:24",
"upload_time_iso_8601": "2024-11-11T11:36:24.392735Z",
"url": "https://files.pythonhosted.org/packages/76/fd/561d4e3001acc01540d78d8778494568ba6fa0deb5e2e01b0d3df2808a5f/rotating_proxy-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-11 11:36:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Will6855",
"github_project": "rotating-proxy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "Requests",
"specs": [
[
"==",
"2.32.3"
]
]
}
],
"lcname": "rotating-proxy"
}