Use a proxy as a string, but achieve broad functionality for various scenarios
Project description
omniproxy
omniproxy parses proxy strings into a str subclass with structured fields (ip, port, credentials, protocol, optional rotation URL), checks proxies through pluggable HTTP clients (httpx, aiohttp, requests, curl_cffi, tls_client), and ships sync/async proxy pools with cooldowns, filters, optional rate limits, and background health monitoring. A small CLI bulk-checks files and scrapes proxy-like lines from URLs.
Use it when you want one canonical type for “proxy as string” in configs and logs, but still need reachability checks, anonymity hints, and pool orchestration without rewriting glue code each time.
Key features
- String-like
Proxytype — behaves as a canonical proxy string while exposing structured data and metadata (latency, anonymity, optional geo-style fields). - Many input formats —
host:port, colon/pipe auth variants, full URLs, SOCKS, bracketed IPv6, trailing[rotation_url]for mobile proxies. - Multi-backend checks — sync and async APIs; optional anonymity classification; configurable default URL lists and retries.
- I/O helpers — read/write proxy lists;
fetch_proxiesto scrape pages over HTTPS. - Pools —
SyncProxyPool/AsyncProxyPoolwith round-robin or random selection, lifecycle hooks, optionalHealthMonitor. - CLI —
omniproxy checkandomniproxy scrapefor quick operational workflows. - Typed —
py.typedmarker; suitable for strict typing in downstream projects.
Documentation
Full narrative docs, CLI details, and an API reference (MkDocs + Material + mkdocstrings) are published from main:
https://mfdi.github.io/omniproxy/
Installation
Python: 3.10 or newer (requires-python = ">=3.10").
Runtime dependencies (always installed with the wheel): msgspec, orjson. HTTP clients are optional extras—install at least one backend you intend to use for checks or the built-in httpx helpers.
pip
pip install omniproxy
With an HTTP backend (recommended for checks and Client / AsyncClient):
pip install "omniproxy[httpx]"
Other extras:
pip install "omniproxy[aiohttp]"
pip install "omniproxy[requests]"
pip install "omniproxy[curl_cffi]"
pip install "omniproxy[tls_client]"
pip install "omniproxy[all]"
uv
uv add omniproxy
With extras:
uv add "omniproxy[httpx]"
uv add "omniproxy[all]"
Quickstart
from omniproxy import Proxy
proxy = Proxy("login:password@210.173.88.77:3001")
print(proxy) # http://login:password@210.173.88.77:3001
print(proxy.url) # canonical URL
print(proxy.server) # protocol://ip:port (no credentials)
print(proxy.as_requests_proxies())
Supported shapes include host:port, host:port:login:password, login:password@host:port, host:port|login:password, and http:// / socks5:// URLs. Mobile rotation API in brackets:
Proxy("login:password@host:port[https://rotate.example/api]")
Full usage
Checking proxies
from omniproxy import Proxy, check_proxy, check_proxies
single = Proxy("10.0.0.1:8000")
proxy, ok = check_proxy(single)
good, bad = check_proxies(
["10.0.0.1:8000", "10.0.0.2:8000"],
backend="httpx",
detect_anonymity=True,
)
Async: acheck_proxy, acheck_proxies, await proxy.acheck(...), await proxy.aget_info(...).
HTTP client wrappers (httpx)
Requires omniproxy[httpx]:
from omniproxy import AsyncClient, Client, Proxy
proxy = Proxy("socks5://login:password@127.0.0.1:9050")
with Client(proxy=proxy) as client:
print(client.get("https://httpbin.org/ip").status_code)
Proxy pool
from omniproxy import ProxyPool
pool = ProxyPool(["10.0.0.1:8000", "10.0.0.2:8000"], strategy="round_robin")
print(pool.get_next())
For new code, prefer SyncProxyPool / AsyncProxyPool from omniproxy.pool (see docs — Pools).
Global configuration
from omniproxy import settings
settings.default_backend = "httpx"
settings.default_timeout = 10.0
settings.default_check_urls = ["https://api.ipify.org/?format=json"]
default_check_urls is a non-empty list used for reachability checks (with rotation across entries on retry). Templates for with_info=True live in settings.default_check_info_url_templates (each must contain {fields}). Details: Configuration.
CLI
omniproxy check proxies.txt --backend httpx --timeout 8 --output-good good.txt
omniproxy scrape https://example.com/proxies -o scraped.txt
See CLI documentation and omniproxy --help.
Project structure
omniproxy/
├── omniproxy/ # Library package
│ ├── backends/ # httpx, aiohttp, requests, curl_cffi, tls_client
│ ├── cli.py
│ ├── config.py
│ ├── extended_proxy.py # Proxy subclass, checks, bulk helpers
│ ├── io.py
│ ├── pool.py
│ ├── proxy.py
│ ├── utils.py
│ └── ...
├── tests/
├── docs/ # MkDocs site source
├── examples/ # Runnable examples
├── scripts/
├── .github/workflows/ # CI (ruff, mypy), docs deploy
├── mkdocs.yml
├── pyproject.toml
├── uv.lock
├── README.md
├── LICENSE
└── FEATURES.md # Architecture checklist (reviewer map)
Contributing
- Fork the repository and create a feature branch from
main. - Make your changes; keep commits focused and messages clear.
- Style: this repo uses Ruff for linting (and formatting where configured). Run
uv run ruff check omniproxy testsbefore opening a PR. - Types: run
uv run mypy omniproxywhen you touch typing-sensitive code. - Tests: run
uv run pytestlocally; fix failures and avoid regressions. - Open a pull request against
mainwith a short description of the change and any trade-offs.
Changelog
There is no root CHANGELOG.md yet. Release history and tags are tracked on GitHub:
https://github.com/mfdi/omniproxy/releases
For semantic versioning, follow the version in omniproxy/__init__.py and PyPI.
Development (from a clone)
uv sync --group dev --group httpx # or rely on [tool.uv] default-groups
uv run ruff check omniproxy tests
uv run mypy omniproxy
uv run pytest
uv build
Preview documentation:
uv sync --group dev --group httpx
uv run mkdocs serve
License
This project is licensed under the MIT License — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 omniproxy-4.0.0.tar.gz.
File metadata
- Download URL: omniproxy-4.0.0.tar.gz
- Upload date:
- Size: 240.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51d0a90c46ce6597b12db6254189ed122857a461bac5f8a77ede17cd4e79d11e
|
|
| MD5 |
de711f50c9e364a44adfd8e791d6cc60
|
|
| BLAKE2b-256 |
3151ddd67904c3c9ce5d27afa2b38cfd5a800c67cbc746e132ca2aff325c608a
|
File details
Details for the file omniproxy-4.0.0-py3-none-any.whl.
File metadata
- Download URL: omniproxy-4.0.0-py3-none-any.whl
- Upload date:
- Size: 57.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd8280705d33a5bd709b4872929ba9669422f2235f3eaac5b34a5231783e1088
|
|
| MD5 |
7f8375f46eb94639d5ac1c6979399a5c
|
|
| BLAKE2b-256 |
75fd580cfd85f09edc72383ac8bfb115b8c60da552607a20038cd4a9e45b4d14
|