Commit ccb903a4 by baiquan

refactor(utils): 重新启用代理验证功能

- 恢复了之前注释掉的代理验证代码
parent 89054d69
......@@ -20,17 +20,17 @@ def check_proxy(proxy_url):
"http": proxy_url,
"https": proxy_url
}
return proxies
# addr = urlparse(proxy_url).hostname
# try:
# test_res = requests.get('http://httpbin.org/ip', timeout=10, proxies=proxies).json()
# except Exception as e:
# raise ProxyConnectionError(f"{addr}-->代理验证失败-->{str(e)}")
# if test_res.get('origin', "") == addr:
# logger.debug(f"{addr}-->代理验证成功")
# return proxies
# else:
# raise ProxyConnectionError(f"{addr}-->代理验证失败")
# return proxies
addr = urlparse(proxy_url).hostname
try:
test_res = requests.get('http://httpbin.org/ip', timeout=10, proxies=proxies).json()
except Exception as e:
raise ProxyConnectionError(f"{addr}-->代理验证失败-->{str(e)}")
if test_res.get('origin', "") == addr:
logger.debug(f"{addr}-->代理验证成功")
return proxies
else:
raise ProxyConnectionError(f"{addr}-->代理验证失败")
def encryptParamsId(login_subject_uid, user_identity_id):
e = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment