pyinproxy 0.1.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.
- pyinproxy-0.1.2/LICENSE +19 -0
- pyinproxy-0.1.2/MANIFEST.in +1 -0
- pyinproxy-0.1.2/PKG-INFO +242 -0
- pyinproxy-0.1.2/README.md +204 -0
- pyinproxy-0.1.2/pyinproxy/__init__.py +9 -0
- pyinproxy-0.1.2/pyinproxy/config.py +1026 -0
- pyinproxy-0.1.2/pyinproxy/exceptions.py +6 -0
- pyinproxy-0.1.2/pyinproxy/main.py +1337 -0
- pyinproxy-0.1.2/pyinproxy/models.py +50 -0
- pyinproxy-0.1.2/pyinproxy.egg-info/PKG-INFO +242 -0
- pyinproxy-0.1.2/pyinproxy.egg-info/SOURCES.txt +17 -0
- pyinproxy-0.1.2/pyinproxy.egg-info/dependency_links.txt +1 -0
- pyinproxy-0.1.2/pyinproxy.egg-info/requires.txt +10 -0
- pyinproxy-0.1.2/pyinproxy.egg-info/top_level.txt +1 -0
- pyinproxy-0.1.2/pyproject.toml +66 -0
- pyinproxy-0.1.2/requirements.txt +7 -0
- pyinproxy-0.1.2/setup.cfg +4 -0
- pyinproxy-0.1.2/setup.py +3 -0
- pyinproxy-0.1.2/tests/test_proxy.py +115 -0
pyinproxy-0.1.2/LICENSE
ADDED
|
@@ -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
|
+
include requirements.txt
|
pyinproxy-0.1.2/PKG-INFO
ADDED
|
@@ -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,204 @@
|
|
|
1
|
+
# inproxy
|
|
2
|
+
|
|
3
|
+
A Python library to fetch free public proxies from multiple online sources, with support for filtering, concurrent fetching, and structured proxy data.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python -m pip install pyinproxy
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from pyinproxy import InProxy
|
|
15
|
+
|
|
16
|
+
proxy = InProxy()
|
|
17
|
+
|
|
18
|
+
proxies = proxy.fetch(count=10)
|
|
19
|
+
|
|
20
|
+
for item in proxies:
|
|
21
|
+
print(item.proxy)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Filtering Proxies
|
|
25
|
+
|
|
26
|
+
You can filter proxies using location, network, anonymity, and latency attributes.
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from pyinproxy import InProxy
|
|
30
|
+
|
|
31
|
+
proxy = InProxy()
|
|
32
|
+
|
|
33
|
+
proxies = proxy.fetch(
|
|
34
|
+
count=10,
|
|
35
|
+
country="India",
|
|
36
|
+
country_code="IN",
|
|
37
|
+
anonymity="elite",
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
for item in proxies:
|
|
41
|
+
print(item.proxy)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Available filters:
|
|
45
|
+
|
|
46
|
+
| Parameter | Description |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `count` | Number of proxies to fetch |
|
|
49
|
+
| `sites` | Specific proxy sources to use |
|
|
50
|
+
| `country` | Filter by country |
|
|
51
|
+
| `country_code` | Filter by country code |
|
|
52
|
+
| `state` | Filter by state |
|
|
53
|
+
| `state_code` | Filter by state code |
|
|
54
|
+
| `city` | Filter by city |
|
|
55
|
+
| `region` | Filter by region |
|
|
56
|
+
| `continent` | Filter by continent |
|
|
57
|
+
| `timezone` | Filter by timezone |
|
|
58
|
+
| `isp` | Filter by ISP |
|
|
59
|
+
| `organization` | Filter by organization |
|
|
60
|
+
| `asn` | Filter by ASN |
|
|
61
|
+
| `anonymity` | Filter by anonymity level |
|
|
62
|
+
| `min_latency` | Minimum latency |
|
|
63
|
+
| `max_latency` | Maximum latency |
|
|
64
|
+
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
## Selecting Proxy Sources
|
|
68
|
+
|
|
69
|
+
By default, `inproxy` uses all configured sources.
|
|
70
|
+
|
|
71
|
+
You can specify individual sources using their names:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from pyinproxy import InProxy
|
|
75
|
+
|
|
76
|
+
proxy = InProxy()
|
|
77
|
+
|
|
78
|
+
proxies = proxy.fetch(
|
|
79
|
+
count=20,
|
|
80
|
+
sites=["proxyscrape", "geonode", "iproyal"],
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
for item in proxies:
|
|
84
|
+
print(item.proxy)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
You can also provide multiple source names as a comma-separated string:
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
proxies = proxy.fetch(
|
|
91
|
+
count=20,
|
|
92
|
+
sites="proxyscrape,geonode,iproyal",
|
|
93
|
+
)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Working with Proxy Results
|
|
97
|
+
|
|
98
|
+
When `count=1`, `fetch` returns the proxy URL as a string if a proxy is found. For
|
|
99
|
+
other counts, it returns a list of structured results with proxy details and metadata.
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from pyinproxy import InProxy
|
|
103
|
+
|
|
104
|
+
proxy = InProxy()
|
|
105
|
+
proxies = proxy.fetch(count=5)
|
|
106
|
+
|
|
107
|
+
for item in proxies:
|
|
108
|
+
print("Proxy:", item.proxy)
|
|
109
|
+
print("IP:", item.ip)
|
|
110
|
+
print("Port:", item.port)
|
|
111
|
+
print("Protocol:", item.protocol)
|
|
112
|
+
print("Country:", item.country)
|
|
113
|
+
print("Country Code:", item.country_code)
|
|
114
|
+
print("Anonymity:", item.anonymity)
|
|
115
|
+
print("Latency:", item.latency)
|
|
116
|
+
print()
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Proxy URL
|
|
120
|
+
|
|
121
|
+
The `.proxy` property returns the proxy in URL format:
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
http://192.168.1.10:8080
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The protocol and port are taken from the proxy data.
|
|
128
|
+
|
|
129
|
+
### Convert to Dictionary
|
|
130
|
+
|
|
131
|
+
Use `to_dict()` to convert a proxy object into a dictionary:
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
proxies = proxy.fetch(count=5)
|
|
135
|
+
|
|
136
|
+
proxy_data = [item.to_dict() for item in proxies]
|
|
137
|
+
|
|
138
|
+
print(proxy_data)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Each dictionary includes the proxy fields and the formatted `proxy` URL.
|
|
142
|
+
|
|
143
|
+
## Using Proxies with Requests
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from curl_cffi import requests
|
|
147
|
+
from pyinproxy import InProxy
|
|
148
|
+
|
|
149
|
+
proxy = InProxy()
|
|
150
|
+
proxy_url = proxy.fetch(count=1)
|
|
151
|
+
|
|
152
|
+
if proxy_url:
|
|
153
|
+
response = requests.get(
|
|
154
|
+
"https://httpbin.org/ip",
|
|
155
|
+
proxies={
|
|
156
|
+
"http": proxy_url,
|
|
157
|
+
"https": proxy_url,
|
|
158
|
+
},
|
|
159
|
+
timeout=15,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
print(response.text)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Configuration
|
|
166
|
+
|
|
167
|
+
You can configure the number of concurrent source workers and the timeout used for source requests:
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from pyinproxy import InProxy
|
|
171
|
+
|
|
172
|
+
proxy = InProxy(
|
|
173
|
+
source_workers=20,
|
|
174
|
+
source_timeout=5,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
proxies = proxy.fetch(count=10)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
| Parameter | Default | Description |
|
|
181
|
+
|---|---:|---|
|
|
182
|
+
| `source_workers` | `20` | Maximum number of concurrent source workers |
|
|
183
|
+
| `source_timeout` | `3` | Timeout in seconds for source requests |
|
|
184
|
+
|
|
185
|
+
## Important Notes
|
|
186
|
+
|
|
187
|
+
- Proxies are collected from public third-party sources.
|
|
188
|
+
- Proxy availability and response times can change at any moment.
|
|
189
|
+
- Not every source provides complete proxy metadata.
|
|
190
|
+
- 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.
|
|
191
|
+
- Public proxies are unreliable and should not be used for sensitive information or credentials.
|
|
192
|
+
|
|
193
|
+
## Requirements
|
|
194
|
+
|
|
195
|
+
- Python 3.10 or higher
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
This project is licensed under the MIT License.
|
|
200
|
+
|
|
201
|
+
## Links
|
|
202
|
+
|
|
203
|
+
- [GitHub Repository](https://github.com/pranavagrawal321/inproxy)
|
|
204
|
+
- [Report an Issue](https://github.com/pranavagrawal321/inproxy/issues)
|