xproxy
特性
- 可定制:可以轻松扩展,将不同来源代理共用。
- 代理验证:自动检查和验证代理的使用次数和过期时间。
- 自动轮换:定期刷新和轮换代理,以确保持续供应有效代理。
- 线程安全:使用多线程处理代理轮换,无阻塞主应用程序。
- 轮询选择:支持轮询代理选择,均匀分配负载。
安装
pip install xproxy
示例
from xproxy.manager import DuoMiProxyManager
import requests
proxy_manager = DuoMiProxyManager( # 代理管理器,会主动记录无效过的代理,防止重复使用无效代理 自动维护代理池有效代理数量,
proxy_url='http://api.dmdaili.com/dmgetip.asp?apikey=3be53e22&pwd=4f2799827bfe9c6f0e2a64749cf5f3f6&getnum=50&httptype=1&geshi=2&fenge=1&fengefu=&operate=all',
max_use_count=5, # 设定单个代理最大使用次数
min_valid_proxies=20, # 设定代理池至少维持20个有效代理
proxy_expiry_seconds=60, # 设定单个代理60秒内 或者达到 endtime的时间记录为超时
rotate_seconds=30 # 定时服务,每隔30秒,检查一遍代理池,如果代理池代理少了,就获取代理
)
proxy = proxy_manager.get_order_proxy() # proxy_manager.get_random_proxy()
response = requests.get(url, headers=headers, proxies={
"http": str(proxy.url), "https": str(proxy.url)}, timeout=60)
if response.status_code != 200:
proxy_manager.mark_proxy_invalid(proxy.url) # 可以主动标记代理为无效
2.1 init project
poetry install -v
2.2 usage
TODO
3. Develop
You may need to read the develop document to use SRC Layout in your IDE.
Metadata
Release files for xproxy 0.1.0
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 |
|---|---|---|---|---|
| xproxy-0.1.0.tar.gz | 6.9 kB | Without provenance | Details for xproxy-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xproxy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for xproxy-0.1.0-py3-none-any.whl |
Total release size: 14.9 kB
Release files / xproxy-0.1.0.tar.gz
| Download URL | xproxy-0.1.0.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90cfaad1ae74ebdbe96d870d866cb99e40964d9ab777e81c47f5e4fe096dc600
|
|
BLAKE2b-256 checksum How to use checksums |
e7ce95bd905a6d1d3d84b996da79c24296e91b95044df378d007005a6c7302c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.13.0 Darwin/23.4.0
|
Release files / xproxy-0.1.0-py3-none-any.whl
| Download URL | xproxy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61559f24541d8f8b5c6426cedc918ac1425e53574490b6f7102c32b1c22fac18
|
|
BLAKE2b-256 checksum How to use checksums |
8a8807ea9564952765e55565e8bce99aa4712cd101fa00f1a4a5c891fe40337c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.13.0 Darwin/23.4.0
|
Security for xproxy 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.