proxy-string 1.0.0__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,185 +1,186 @@
1
- # Byte-compiled / optimized / DLL files
2
- __pycache__/
3
- *.py[cod]
4
- *$py.class
5
-
6
- # C extensions
7
- *.so
8
-
9
- # Distribution / packaging
10
- .Python
11
- build/
12
- develop-eggs/
13
- dist/
14
- downloads/
15
- eggs/
16
- .eggs/
17
- lib/
18
- lib64/
19
- parts/
20
- sdist/
21
- var/
22
- wheels/
23
- share/python-wheels/
24
- *.egg-info/
25
- .installed.cfg
26
- *.egg
27
- MANIFEST
28
-
29
- # PyInstaller
30
- # Usually these files are written by a python script from a template
31
- # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
- *.manifest
33
- *.spec
34
-
35
- # Installer logs
36
- pip-log.txt
37
- pip-delete-this-directory.txt
38
-
39
- # Unit test / coverage reports
40
- htmlcov/
41
- .tox/
42
- .nox/
43
- .coverage
44
- .coverage.*
45
- .cache
46
- nosetests.xml
47
- coverage.xml
48
- *.cover
49
- *.py,cover
50
- .hypothesis/
51
- .pytest_cache/
52
- cover/
53
-
54
- # Translations
55
- *.mo
56
- *.pot
57
-
58
- # Django stuff:
59
- *.log
60
- local_settings.py
61
- db.sqlite3
62
- db.sqlite3-journal
63
-
64
- # Flask stuff:
65
- instance/
66
- .webassets-cache
67
-
68
- # Scrapy stuff:
69
- .scrapy
70
-
71
- # Sphinx documentation
72
- docs/_build/
73
-
74
- # PyBuilder
75
- .pybuilder/
76
- target/
77
-
78
- # Jupyter Notebook
79
- .ipynb_checkpoints
80
-
81
- # IPython
82
- profile_default/
83
- ipython_config.py
84
-
85
- # pyenv
86
- # For a library or package, you might want to ignore these files since the code is
87
- # intended to run in multiple environments; otherwise, check them in:
88
- # .python-version
89
-
90
- # pipenv
91
- # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
- # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
- # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
- # install all needed dependencies.
95
- #Pipfile.lock
96
-
97
- # UV
98
- # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
- # This is especially recommended for binary packages to ensure reproducibility, and is more
100
- # commonly ignored for libraries.
101
- #uv.lock
102
-
103
- # poetry
104
- # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
- # This is especially recommended for binary packages to ensure reproducibility, and is more
106
- # commonly ignored for libraries.
107
- # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
- #poetry.lock
109
-
110
- # pdm
111
- # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
- #pdm.lock
113
- # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
- # in version control.
115
- # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
- .pdm.toml
117
- .pdm-python
118
- .pdm-build/
119
-
120
- # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
- __pypackages__/
122
-
123
- # Celery stuff
124
- celerybeat-schedule
125
- celerybeat.pid
126
-
127
- # SageMath parsed files
128
- *.sage.py
129
-
130
- # Environments
131
- .env
132
- .venv
133
- env/
134
- venv/
135
- ENV/
136
- env.bak/
137
- venv.bak/
138
-
139
- # Spyder project settings
140
- .spyderproject
141
- .spyproject
142
-
143
- # Rope project settings
144
- .ropeproject
145
-
146
- # mkdocs documentation
147
- /site
148
-
149
- # mypy
150
- .mypy_cache/
151
- .dmypy.json
152
- dmypy.json
153
-
154
- # Pyre type checker
155
- .pyre/
156
-
157
- # pytype static type analyzer
158
- .pytype/
159
-
160
- # Cython debug symbols
161
- cython_debug/
162
-
163
- # PyCharm
164
- # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
- # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
- # and can be added to the global gitignore or merged into this file. For a more nuclear
167
- # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
- #.idea/
169
-
170
- # Ruff stuff:
171
- .ruff_cache/
172
-
173
- # PyPI configuration file
174
- .pypirc
175
-
176
- .old
177
- .tests.old
178
- test.py
179
- test2.py
180
- test3.py
181
- *.wpr
182
- *.wpu
183
-
184
- # Antigravity agents / skills
185
- .agents/
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ # Project aux scripts
177
+ scripts/
178
+
179
+ # Wing IDE project files
180
+ *.wpr
181
+ *.wpu
182
+
183
+ # AI / agents / skills
184
+ .agents/
185
+ .skills/
186
+ AGENTS.md
@@ -1,19 +1,19 @@
1
- Copyright (c) 2018 The Python Packaging Authority
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ Copyright (c) 2018 The Python Packaging Authority
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
19
  SOFTWARE.
@@ -0,0 +1,157 @@
1
+ Metadata-Version: 2.5
2
+ Name: proxy-string
3
+ Version: 1.0.2
4
+ Summary: Proxy server data representation and parser package.
5
+ Project-URL: Homepage, https://github.com/sergey-scat/proxy-string
6
+ Project-URL: Documentation, https://sergey-scat.github.io/proxy-string/
7
+ Project-URL: Issues, https://github.com/sergey-scat/proxy-string/issues
8
+ Author-email: Sergey Scat <py.unicaps@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Programming Language :: Python :: 3.15
23
+ Classifier: Topic :: Software Development :: Libraries
24
+ Requires-Python: <4,>=3.12
25
+ Requires-Dist: aiofiles>=25.1.0
26
+ Requires-Dist: attrs>=26.1.0
27
+ Requires-Dist: pywhatwgurl>=0.1.2
28
+ Provides-Extra: ada-url
29
+ Requires-Dist: ada-url>=4.0.0; extra == 'ada-url'
30
+ Provides-Extra: can-ada
31
+ Requires-Dist: can-ada>=3.1.0; extra == 'can-ada'
32
+ Description-Content-Type: text/markdown
33
+
34
+ <p align="center">
35
+ <img src="assets/logo.jpg" alt="proxy-string logo" width="220" />
36
+ </p>
37
+
38
+ <h1 align="center">proxy-string</h1>
39
+
40
+ <p align="center">
41
+ <a href="https://sergey-scat.github.io/proxy-string/"><img src="https://img.shields.io/badge/docs-GitHub%20Pages-blue.svg" alt="Documentation" /></a>
42
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.12%2B-blue.svg" alt="Python" /></a>
43
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
44
+ <a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/badge/code%20style-ruff-000000.svg" alt="Code style: ruff" /></a>
45
+ <a href="https://github.com/bwhmather/ty"><img src="https://img.shields.io/badge/types-ty-blueviolet.svg" alt="Checked with ty" /></a>
46
+ <a href="https://github.com/sergey-scat/proxy-string"><img src="https://img.shields.io/badge/coverage-100%25-brightgreen.svg" alt="Coverage" /></a>
47
+ </p>
48
+
49
+ <p align="center">
50
+ A lightweight, type-safe Python library for parsing, validating, and converting proxy server connection data.
51
+ </p>
52
+
53
+ <p align="center">
54
+ <strong><a href="https://sergey-scat.github.io/proxy-string/">📖 Read the Documentation</a></strong>
55
+ </p>
56
+
57
+ ---
58
+
59
+ ## Features
60
+
61
+ - **WHATWG URL Standard**: Conforms to modern WHATWG URL standards via pure-Python `pywhatwgurl` with optional high-speed C++ backends (`can-ada`, `ada-url`).
62
+ - **Protocols Supported**: HTTP, HTTPS, SOCKS4, and SOCKS5 (with `socks4a` and `socks5h` remote DNS schemes).
63
+ - **Network Compatibility**: Full support for IPv4, IPv6 (RFC bracketed), UTF-8 Unicode credentials, and IDN / Punycode domain names.
64
+ - **Flexible Ingestion**: Parse from URLs, strings (with format auto-detection), dictionaries, JSON, and text files (sync & async generators).
65
+ - **Immutable & Safe**: Frozen `@attrs.frozen` instances with `with_*` evolution methods and strict port/protocol validation.
66
+ - **Client Integrations**: Built-in `prepare_for()` for `requests`, `httpx`, `aiohttp`, `playwright`, `curl_cffi`, and more.
67
+
68
+ ---
69
+
70
+ ## Installation
71
+
72
+ ```bash
73
+ # Using uv (recommended)
74
+ uv add proxy-string
75
+
76
+ # Using pip
77
+ pip install proxy-string
78
+ ```
79
+
80
+ For maximum URL parsing throughput, optional C++ WHATWG URL backends can be installed:
81
+
82
+ ```bash
83
+ uv add "proxy-string[can_ada]" # or "proxy-string[ada_url]"
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Quick Start
89
+
90
+ ```python
91
+ from proxy_string import ProxyServer, ProxyServerProtocol
92
+
93
+ # 1. Parse from URL (supports Unicode credentials and remote DNS)
94
+ proxy = ProxyServer.from_url("socks5h://юзер:пароль@proxy.example.com:1080")
95
+ print(proxy.protocol) # ProxyServerProtocol.SOCKS5
96
+ print(proxy.remote_dns) # True
97
+
98
+ # 2. Parse from text string (format auto-detected)
99
+ auto = ProxyServer.from_string("192.168.1.1:8080:alice:secret")
100
+ print(auto.host) # '192.168.1.1'
101
+ print(auto.port) # 8080
102
+
103
+ # 3. Create modified copies (objects are immutable)
104
+ updated = auto.with_port(9090).with_creds("bob", "new_pass")
105
+
106
+ # 4. Export configuration for third-party HTTP clients
107
+ requests_config = updated.prepare_for("requests")
108
+ print(requests_config)
109
+ # {'http': 'http://bob:new_pass@192.168.1.1:9090', 'https': 'http://bob:new_pass@192.168.1.1:9090'}
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Documentation
115
+
116
+ Full documentation with interactive search and detailed guides is available at:
117
+ **[https://sergey-scat.github.io/proxy-string/](https://sergey-scat.github.io/proxy-string/)**
118
+
119
+ - **[Installation Guide](https://sergey-scat.github.io/proxy-string/getting-started/installation/)**: Package installation and C++ backend selection.
120
+ - **[Quickstart Tutorial](https://sergey-scat.github.io/proxy-string/getting-started/quickstart/)**: Step-by-step introduction.
121
+ - **[Parsing Sources](https://sergey-scat.github.io/proxy-string/guides/parsing/)**: Parsing URLs, strings, files (sync/async), JSON, and IDN.
122
+ - **[Supported Formats](https://sergey-scat.github.io/proxy-string/guides/formats/)**: Detailed proxy string formats and auto-detection rules.
123
+ - **[Modifying Proxies](https://sergey-scat.github.io/proxy-string/guides/evolution/)**: Immutability and `with_*` methods.
124
+ - **[Client Integrations](https://sergey-scat.github.io/proxy-string/guides/integrations/)**: Configuration recipes for `requests`, `httpx`, `aiohttp`, `playwright`, `curl_cffi`, etc.
125
+ - **[API Reference](https://sergey-scat.github.io/proxy-string/reference/proxy-server/)**: Complete autogenerated reference for all classes and functions.
126
+
127
+ ---
128
+
129
+ ## Development
130
+
131
+ ```bash
132
+ # Clone the repository
133
+ git clone https://github.com/sergey-scat/proxy-string.git
134
+ cd proxy-string
135
+
136
+ # Install all dependencies including docs and dev groups
137
+ uv sync --all-extras --dev --group docs
138
+
139
+ # Run tests with coverage
140
+ uv run pytest
141
+
142
+ # Check code formatting and linting
143
+ uv run ruff check .
144
+ uv run ruff format --check .
145
+
146
+ # Static type check
147
+ uv run ty check src/proxy_string
148
+
149
+ # Build documentation locally
150
+ uv run mkdocs serve
151
+ ```
152
+
153
+ ---
154
+
155
+ ## License
156
+
157
+ This project is licensed under the [MIT License](LICENSE).