pyinproxy 0.1.2__py3-none-any.whl

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.
pyinproxy/models.py ADDED
@@ -0,0 +1,50 @@
1
+ from dataclasses import asdict, dataclass
2
+ from typing import Any
3
+
4
+
5
+ @dataclass
6
+ class Proxy:
7
+ ip: str
8
+ port: int | None = None
9
+ protocol: str = "http"
10
+ country: str | None = None
11
+ country_code: str | None = None
12
+ state: str | None = None
13
+ state_code: str | None = None
14
+ city: str | None = None
15
+ region: str | None = None
16
+ continent: str | None = None
17
+ timezone: str | None = None
18
+ isp: str | None = None
19
+ organization: str | None = None
20
+ asn: int | None = None
21
+ anonymity: str | None = None
22
+ latency: float | None = None
23
+ source: str | None = None
24
+ continent_code: str | None = None
25
+ pincode: str | None = None
26
+ google: bool | None = None
27
+
28
+ @property
29
+ def proxy(self) -> str:
30
+ protocol = (self.protocol or "http").lower()
31
+ ip = str(self.ip).strip()
32
+
33
+ if ":" in ip and not ip.startswith("["):
34
+ ip = f"[{ip}]"
35
+
36
+ if self.port is None:
37
+ return f"{protocol}://{ip}"
38
+
39
+ return f"{protocol}://{ip}:{self.port}"
40
+
41
+ def __str__(self) -> str:
42
+ return self.proxy
43
+
44
+ def __repr__(self) -> str:
45
+ return self.proxy
46
+
47
+ def to_dict(self) -> dict[str, Any]:
48
+ data = asdict(self)
49
+ data["proxy"] = self.proxy
50
+ return data
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyinproxy
3
+ Version: 0.1.2
4
+ Summary: Collect and filter public proxies from multiple online sources.
5
+ Author-email: Pranav Agrawal <pranavagrawal321@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/pranavagrawal321/inproxy
8
+ Project-URL: Repository, https://github.com/pranavagrawal321/inproxy
9
+ Project-URL: Issues, https://github.com/pranavagrawal321/inproxy/issues
10
+ Project-URL: Changelog, https://github.com/pranavagrawal321/inproxy/releases
11
+ Keywords: proxy,proxy-scraper,proxy-list,http-proxy,socks-proxy,web-scraping
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: 3.15
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Topic :: Internet :: WWW/HTTP
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: curl_cffi
29
+ Requires-Dist: fake-useragent
30
+ Requires-Dist: lxml
31
+ Requires-Dist: pandas
32
+ Provides-Extra: dev
33
+ Requires-Dist: build>=1.2; extra == "dev"
34
+ Requires-Dist: pre-commit>=4.0; extra == "dev"
35
+ Requires-Dist: ruff>=0.8; extra == "dev"
36
+ Requires-Dist: twine>=5.0; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ # inproxy
40
+
41
+ A Python library to fetch free public proxies from multiple online sources, with support for filtering, concurrent fetching, and structured proxy data.
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ python -m pip install pyinproxy
47
+ ```
48
+
49
+ ## Quick Start
50
+
51
+ ```python
52
+ from pyinproxy import InProxy
53
+
54
+ proxy = InProxy()
55
+
56
+ proxies = proxy.fetch(count=10)
57
+
58
+ for item in proxies:
59
+ print(item.proxy)
60
+ ```
61
+
62
+ ## Filtering Proxies
63
+
64
+ You can filter proxies using location, network, anonymity, and latency attributes.
65
+
66
+ ```python
67
+ from pyinproxy import InProxy
68
+
69
+ proxy = InProxy()
70
+
71
+ proxies = proxy.fetch(
72
+ count=10,
73
+ country="India",
74
+ country_code="IN",
75
+ anonymity="elite",
76
+ )
77
+
78
+ for item in proxies:
79
+ print(item.proxy)
80
+ ```
81
+
82
+ Available filters:
83
+
84
+ | Parameter | Description |
85
+ |---|---|
86
+ | `count` | Number of proxies to fetch |
87
+ | `sites` | Specific proxy sources to use |
88
+ | `country` | Filter by country |
89
+ | `country_code` | Filter by country code |
90
+ | `state` | Filter by state |
91
+ | `state_code` | Filter by state code |
92
+ | `city` | Filter by city |
93
+ | `region` | Filter by region |
94
+ | `continent` | Filter by continent |
95
+ | `timezone` | Filter by timezone |
96
+ | `isp` | Filter by ISP |
97
+ | `organization` | Filter by organization |
98
+ | `asn` | Filter by ASN |
99
+ | `anonymity` | Filter by anonymity level |
100
+ | `min_latency` | Minimum latency |
101
+ | `max_latency` | Maximum latency |
102
+
103
+ Note: Filtering depends on the metadata provided by each proxy source. Sources that do not provide a particular field cannot satisfy a filter on that field.
104
+
105
+ ## Selecting Proxy Sources
106
+
107
+ By default, `inproxy` uses all configured sources.
108
+
109
+ You can specify individual sources using their names:
110
+
111
+ ```python
112
+ from pyinproxy import InProxy
113
+
114
+ proxy = InProxy()
115
+
116
+ proxies = proxy.fetch(
117
+ count=20,
118
+ sites=["proxyscrape", "geonode", "iproyal"],
119
+ )
120
+
121
+ for item in proxies:
122
+ print(item.proxy)
123
+ ```
124
+
125
+ You can also provide multiple source names as a comma-separated string:
126
+
127
+ ```python
128
+ proxies = proxy.fetch(
129
+ count=20,
130
+ sites="proxyscrape,geonode,iproyal",
131
+ )
132
+ ```
133
+
134
+ ## Working with Proxy Results
135
+
136
+ When `count=1`, `fetch` returns the proxy URL as a string if a proxy is found. For
137
+ other counts, it returns a list of structured results with proxy details and metadata.
138
+
139
+ ```python
140
+ from pyinproxy import InProxy
141
+
142
+ proxy = InProxy()
143
+ proxies = proxy.fetch(count=5)
144
+
145
+ for item in proxies:
146
+ print("Proxy:", item.proxy)
147
+ print("IP:", item.ip)
148
+ print("Port:", item.port)
149
+ print("Protocol:", item.protocol)
150
+ print("Country:", item.country)
151
+ print("Country Code:", item.country_code)
152
+ print("Anonymity:", item.anonymity)
153
+ print("Latency:", item.latency)
154
+ print()
155
+ ```
156
+
157
+ ### Proxy URL
158
+
159
+ The `.proxy` property returns the proxy in URL format:
160
+
161
+ ```python
162
+ http://192.168.1.10:8080
163
+ ```
164
+
165
+ The protocol and port are taken from the proxy data.
166
+
167
+ ### Convert to Dictionary
168
+
169
+ Use `to_dict()` to convert a proxy object into a dictionary:
170
+
171
+ ```python
172
+ proxies = proxy.fetch(count=5)
173
+
174
+ proxy_data = [item.to_dict() for item in proxies]
175
+
176
+ print(proxy_data)
177
+ ```
178
+
179
+ Each dictionary includes the proxy fields and the formatted `proxy` URL.
180
+
181
+ ## Using Proxies with Requests
182
+
183
+ ```python
184
+ from curl_cffi import requests
185
+ from pyinproxy import InProxy
186
+
187
+ proxy = InProxy()
188
+ proxy_url = proxy.fetch(count=1)
189
+
190
+ if proxy_url:
191
+ response = requests.get(
192
+ "https://httpbin.org/ip",
193
+ proxies={
194
+ "http": proxy_url,
195
+ "https": proxy_url,
196
+ },
197
+ timeout=15,
198
+ )
199
+
200
+ print(response.text)
201
+ ```
202
+
203
+ ## Configuration
204
+
205
+ You can configure the number of concurrent source workers and the timeout used for source requests:
206
+
207
+ ```python
208
+ from pyinproxy import InProxy
209
+
210
+ proxy = InProxy(
211
+ source_workers=20,
212
+ source_timeout=5,
213
+ )
214
+
215
+ proxies = proxy.fetch(count=10)
216
+ ```
217
+
218
+ | Parameter | Default | Description |
219
+ |---|---:|---|
220
+ | `source_workers` | `20` | Maximum number of concurrent source workers |
221
+ | `source_timeout` | `3` | Timeout in seconds for source requests |
222
+
223
+ ## Important Notes
224
+
225
+ - Proxies are collected from public third-party sources.
226
+ - Proxy availability and response times can change at any moment.
227
+ - Not every source provides complete proxy metadata.
228
+ - A requested number of proxies is a target, not a guarantee. Results may contain fewer proxies than requested; a `count=1` request returns an empty list if none are found.
229
+ - Public proxies are unreliable and should not be used for sensitive information or credentials.
230
+
231
+ ## Requirements
232
+
233
+ - Python 3.10 or higher
234
+
235
+ ## License
236
+
237
+ This project is licensed under the MIT License.
238
+
239
+ ## Links
240
+
241
+ - [GitHub Repository](https://github.com/pranavagrawal321/inproxy)
242
+ - [Report an Issue](https://github.com/pranavagrawal321/inproxy/issues)
@@ -0,0 +1,10 @@
1
+ pyinproxy/__init__.py,sha256=lMQt4n-A_oe9kSY8QLm4ayvIZSek7j0romgjscH8oZE,180
2
+ pyinproxy/config.py,sha256=4NyXK5Cz2MWrs4_SFshpiFBKVGJ5MW7rEzss86nrq1Q,33075
3
+ pyinproxy/exceptions.py,sha256=E2FW4NEFIR4MXHYSk7SXDSCvogq7hyFEvIGJQbxobQY,103
4
+ pyinproxy/main.py,sha256=f2J_tROZwFkqWMI75GmAEZa8WHNWnxowRNlLFZfrqtg,38957
5
+ pyinproxy/models.py,sha256=MhssDfkUU_eYOulcete63xBCyin0zZUTmRUNOTTZN1k,1264
6
+ pyinproxy-0.1.2.dist-info/licenses/LICENSE,sha256=5qRG87sdAl956DdSwrM38ONtRU2OzKvy0hR-QXwGBwQ,1057
7
+ pyinproxy-0.1.2.dist-info/METADATA,sha256=oiWeJLh3-Mll_fbr54A1FiRHYXjrO8ulVUsQpRPVIxw,6246
8
+ pyinproxy-0.1.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
9
+ pyinproxy-0.1.2.dist-info/top_level.txt,sha256=w3Ru3iQkabCkwq3QqFnFDz0_b3BC32gA1iCKZ-axqN4,10
10
+ pyinproxy-0.1.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 Pranav Agrawal
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
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ pyinproxy