ReqProxy
A Python library for making HTTP requests through a rotating set of proxies.
Overview
ReqProxy is a lightweight Python library that provides a simple way to make HTTP requests through a rotating set of proxies. It automatically handles proxy selection and error management, attempting multiple proxies until a successful response is received or all proxies have been tried.
Features
- Supports all common HTTP methods (GET, POST, PUT, PATCH, DELETE)
- Automatically rotates through a list of proxies
- Handles proxy failures gracefully
- Similar interface to the popular
requestslibrary - Configurable timeout and proxy sample size
Installation
pip install reqproxy
Usage
Basic Usage
from reqproxy import ProxyRequests
# List of proxy URLs
proxies = [
"http://user1:pass1@192.168.1.1:8080",
"http://user2:pass2@192.168.1.2:8080"
]
# Create a ProxyRequests instance
proxy_req = ProxyRequests(proxy_list=proxies)
# Make a GET request
response = proxy_req.get('https://example.com')
print(response.status_code) # 200
print(response.text) # HTML content
Making POST Requests with JSON Data
from reqproxy import ProxyRequests
proxies = ["http://user:pass@proxy.example.com:8080"]
proxy_req = ProxyRequests(proxy_list=proxies, timeout=5.0)
# JSON data to send
data = {"username": "test_user", "password": "test_pass"}
# Make a POST request with JSON data
response = proxy_req.post('https://api.example.com/login', json=data)
result = response.json()
Using Custom Parameters and Headers
headers = {"User-Agent": "Custom User Agent"}
params = {"page": 1, "limit": 10}
response = proxy_req.get(
'https://api.example.com/products',
params=params,
headers=headers
)
Configuration Options
When creating a ProxyRequests instance, you can configure the following options:
proxy_list(required): A list of proxy URLs with the format "http://user:pass@ip:port"proxy_sample_size(optional): The number of proxies to sample for each request (default: 10)timeout(optional): The timeout for requests in seconds (default: 10.0)
Error Handling
If all proxies fail, a ProxyRequestException is raised containing all the individual errors:
from reqproxy import ProxyRequests, ProxyRequestException
try:
proxy_req = ProxyRequests(proxy_list=["http://invalid.proxy:8080"])
response = proxy_req.get('https://example.com')
except ProxyRequestException as e:
print(f"All proxies failed: {e}")
# Access individual errors
for error in e.errors:
print(f"Error: {error}")
Requirements
- Python 3.12+
- requests library
License
This project is licensed under the terms of the MIT license.
Metadata
Release files for reqproxy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| reqproxy-0.1.0.tar.gz | 7.6 kB | Without provenance | Details for reqproxy-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reqproxy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for reqproxy-0.1.0-py3-none-any.whl |
Total release size: 12.7 kB
Release files / reqproxy-0.1.0.tar.gz
| Download URL | reqproxy-0.1.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73aa96e130113d2486a587961941ff59cac6a698284b4d1a8c3119de4e6ad98a
|
|
BLAKE2b-256 checksum How to use checksums |
cde944f518e035b7969b32cf6a44289dfd3e4cc420c76e01c84342e62b997f28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.13
|
Release files / reqproxy-0.1.0-py3-none-any.whl
| Download URL | reqproxy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b4a479a51ecb00d2eb0e644c2cbb875c429e329dc3be56e413550394e276fc5b
|
|
BLAKE2b-256 checksum How to use checksums |
531392929bf8b3fd5e8d3dfc1936af072706287ba5ecb2007309be59d809b572
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.13
|
Security for reqproxy 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.