My Awesome Project!
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xproxy-0.1.0.tar.gz
(6.9 kB
view details)
Built Distribution
File details
Details for the file xproxy-0.1.0.tar.gz
.
File metadata
- Download URL: xproxy-0.1.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90cfaad1ae74ebdbe96d870d866cb99e40964d9ab777e81c47f5e4fe096dc600 |
|
MD5 | f5ba5db14cb46cba0d4be9f9703b63d3 |
|
BLAKE2b-256 | e7ce95bd905a6d1d3d84b996da79c24296e91b95044df378d007005a6c7302c7 |
File details
Details for the file xproxy-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: xproxy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61559f24541d8f8b5c6426cedc918ac1425e53574490b6f7102c32b1c22fac18 |
|
MD5 | 602093806cd89e92470c08dbf4e15a75 |
|
BLAKE2b-256 | 8a8807ea9564952765e55565e8bce99aa4712cd101fa00f1a4a5c891fe40337c |