优化代理相关, 移除旧的死代码
This commit is contained in:
@@ -145,30 +145,18 @@ class ProxyResolver:
|
||||
|
||||
def resolve_working_proxy(
|
||||
api_url: str,
|
||||
whitelist_uid: str = "",
|
||||
whitelist_ukey: str = "",
|
||||
whitelist_platform: str = "xiequ",
|
||||
whitelist_credentials: dict = None,
|
||||
max_attempts: int = 4,
|
||||
log_func: Optional[LogFunc] = None,
|
||||
) -> tuple[Optional[str], str]:
|
||||
"""
|
||||
从代理 API 获取可用代理,自动处理白名单同步。
|
||||
|
||||
支持:
|
||||
- 新参数:whitelist_platform + whitelist_credentials
|
||||
- 旧参数:whitelist_uid + whitelist_ukey(向后兼容)
|
||||
"""
|
||||
# 构建白名单同步器
|
||||
_wl_platform = whitelist_platform or "xiequ"
|
||||
_wl_credentials = whitelist_credentials
|
||||
if not _wl_credentials and whitelist_uid and whitelist_ukey:
|
||||
_wl_platform = "xiequ"
|
||||
_wl_credentials = {"uid": whitelist_uid, "ukey": whitelist_ukey}
|
||||
|
||||
"""从代理 API 获取可用代理,自动处理白名单同步。"""
|
||||
syncer = (
|
||||
DouyuWhitelistSyncer(platform=_wl_platform, credentials=_wl_credentials)
|
||||
if _wl_credentials
|
||||
DouyuWhitelistSyncer(
|
||||
platform=whitelist_platform or "xiequ",
|
||||
credentials=whitelist_credentials,
|
||||
)
|
||||
if whitelist_credentials
|
||||
else None
|
||||
)
|
||||
resolver = ProxyResolver(
|
||||
|
||||
Reference in New Issue
Block a user