proxy-string
A lightweight, type-safe Python library for parsing, validating, and converting proxy server connection data.
Features
- WHATWG URL Standard: Conforms to modern WHATWG URL standards via pure-Python
pywhatwgurlwith optional high-speed C++ backends (can-ada,ada-url). - Protocols Supported: HTTP, HTTPS, SOCKS4, and SOCKS5 (with
socks4aandsocks5hremote DNS schemes). - Network Compatibility: Full support for IPv4, IPv6 (RFC bracketed), UTF-8 Unicode credentials, and IDN / Punycode domain names.
- Flexible Ingestion: Parse from URLs, strings (with format auto-detection), dictionaries, JSON, and text files (sync & async generators).
- Immutable & Safe: Frozen
@attrs.frozeninstances withwith_*evolution methods and strict port/protocol validation. - Client Integrations: Built-in
prepare_for()forrequests,httpx,aiohttp,playwright,curl_cffi, and more.
Installation
# Using uv (recommended)
uv add proxy-string
# Using pip
pip install proxy-string
For maximum URL parsing throughput, optional C++ WHATWG URL backends can be installed:
uv add "proxy-string[can_ada]" # or "proxy-string[ada_url]"
Quick Start
from proxy_string import ProxyServer, ProxyServerProtocol
# 1. Parse from URL (supports Unicode credentials and remote DNS)
proxy = ProxyServer.from_url("socks5h://юзер:пароль@proxy.example.com:1080")
print(proxy.protocol) # ProxyServerProtocol.SOCKS5
print(proxy.remote_dns) # True
# 2. Parse from text string (format auto-detected)
auto = ProxyServer.from_string("192.168.1.1:8080:alice:secret")
print(auto.host) # '192.168.1.1'
print(auto.port) # 8080
# 3. Create modified copies (objects are immutable)
updated = auto.with_port(9090).with_creds("bob", "new_pass")
# 4. Export configuration for third-party HTTP clients
requests_config = updated.prepare_for("requests")
print(requests_config)
# {'http': 'http://bob:new_pass@192.168.1.1:9090', 'https': 'http://bob:new_pass@192.168.1.1:9090'}
Documentation
Full documentation with interactive search and detailed guides is available at: https://sergey-scat.github.io/proxy-string/
- Installation Guide: Package installation and C++ backend selection.
- Quickstart Tutorial: Step-by-step introduction.
- Parsing Sources: Parsing URLs, strings, files (sync/async), JSON, and IDN.
- Supported Formats: Detailed proxy string formats and auto-detection rules.
- Modifying Proxies: Immutability and
with_*methods. - Client Integrations: Configuration recipes for
requests,httpx,aiohttp,playwright,curl_cffi, etc. - API Reference: Complete autogenerated reference for all classes and functions.
Development
# Clone the repository
git clone https://github.com/sergey-scat/proxy-string.git
cd proxy-string
# Install all dependencies including docs and dev groups
uv sync --all-extras --dev --group docs
# Run tests with coverage
uv run pytest
# Check code formatting and linting
uv run ruff check .
uv run ruff format --check .
# Static type check
uv run ty check src/proxy_string
# Build documentation locally
uv run mkdocs serve
License
This project is licensed under the MIT License.
Metadata
Release files for proxy-string 1.0.2
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 |
|---|---|---|---|---|
| proxy_string-1.0.2.tar.gz | 15.3 kB | With provenance | Details for proxy_string-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| proxy_string-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for proxy_string-1.0.2-py3-none-any.whl |
Total release size: 31.6 kB
Release files / proxy_string-1.0.2.tar.gz
| Download URL | proxy_string-1.0.2.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9180bd83742a262a1b369a37fca816aba420a49dba674a5313766f14b28d1579
|
|
BLAKE2b-256 checksum How to use checksums |
8ddb854aafcbe670c4bf94a7820dc1f68cfc86cf8341c78651ed346f9924eed2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / proxy_string-1.0.2-py3-none-any.whl
| Download URL | proxy_string-1.0.2-py3-none-any.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
48e288b65ad257074f7f006025a90e185df9d9c26a033305d3d35ff37383f997
|
|
BLAKE2b-256 checksum How to use checksums |
69877d1526dee125d37dffb976c71f0edebcf223cf7ce89fcb00530e017ce895
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logSecurity for proxy-string 1.0.2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for proxy_string-1.0.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logA 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.