Proxy-backed HTTP session utilities with retry and rotation support.
Project description
rotate-session
rotate-session is a small Python package for HTTP requests with retry support and optional proxy rotation.
Installation
pip install rotate-session
Features
- Retry failed requests with configurable attempts and wait time
- Rotate across a list of proxies automatically on retry
- Fetch proxy lists from Webshare
- Use plain
requests-style proxies when provider integration is not needed
Quick start
from rotate_session import RotateSession
session = RotateSession()
response = session.get("https://httpbin.org/get", timeout=20)
print(response.status_code)
Configure retries
from rotate_session import RetryConfig, RotateSession
retry = RetryConfig(max_retries=5, wait_secs=2)
session = RotateSession(retry_config=retry)
Use your own proxy list
from rotate_session import ProxyConfig, RotateSession
proxy_config = ProxyConfig(
proxies=[
{"http": "http://user:pass@1.2.3.4:8080", "https": "http://user:pass@1.2.3.4:8080"},
{"http": "http://user:pass@5.6.7.8:8080", "https": "http://user:pass@5.6.7.8:8080"},
]
)
session = RotateSession(proxy_config=proxy_config)
response = session.get("https://httpbin.org/ip", timeout=20)
print(response.text)
Use Webshare as proxy provider
from rotate_session import ProxyConfig, ProxyProvider, RotateSession
proxy_config = ProxyConfig(
provider=ProxyProvider.WEBSHARE,
api_key="YOUR_WEBSHARE_API_KEY",
)
session = RotateSession(
proxy_config=proxy_config,
proxies_fetch_params={"country_codes": ["US"], "mode": "direct"},
)
response = session.get("https://httpbin.org/ip", timeout=20)
print(response.text)
Notes
- Documentation and this README were generated with AI.
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
rotate_session-0.1.0.tar.gz
(6.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rotate_session-0.1.0.tar.gz.
File metadata
- Download URL: rotate_session-0.1.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6678d3e2cf80eab191b7331d40c890c7963c8f807bda279e5581ce732f877696
|
|
| MD5 |
cbef45600ca74efd3aa7c2d00b67816d
|
|
| BLAKE2b-256 |
9c07b901079c67f7ee0b3cca314531c91f548012b82f74c90bc018071641eede
|
File details
Details for the file rotate_session-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rotate_session-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0294e4ed52715d4a64dac015cb7a51a918c6255e92201a559269df691cfb680f
|
|
| MD5 |
08f6225a651917a1afe00e69551f3559
|
|
| BLAKE2b-256 |
06f84e956f5db126cc110251e6868b0b51c0c769e602cdca5212885d21e93817
|