Commit 7dd526f7 by baiquan

refactor(shop): 调整任务日志输出位置

- 将任务日志输出从函数开头调整到判断任务为空之后
- 优化了日志输出的可读性和时机,确保仅在存在任务时才输出任务信息
parent 6f39c8d8
...@@ -20,16 +20,17 @@ def check_proxy(proxy_url): ...@@ -20,16 +20,17 @@ def check_proxy(proxy_url):
"http": proxy_url, "http": proxy_url,
"https": proxy_url "https": proxy_url
} }
addr = urlparse(proxy_url).hostname return proxies
try: # addr = urlparse(proxy_url).hostname
test_res = requests.get('http://httpbin.org/ip', timeout=10, proxies=proxies).json() # try:
except Exception as e: # test_res = requests.get('http://httpbin.org/ip', timeout=10, proxies=proxies).json()
raise ProxyConnectionError(f"{addr}-->代理验证失败-->{str(e)}") # except Exception as e:
if test_res.get('origin', "") == addr: # raise ProxyConnectionError(f"{addr}-->代理验证失败-->{str(e)}")
logger.debug(f"{addr}-->代理验证成功") # if test_res.get('origin', "") == addr:
return proxies # logger.debug(f"{addr}-->代理验证成功")
else: # return proxies
raise ProxyConnectionError(f"{addr}-->代理验证失败") # else:
# raise ProxyConnectionError(f"{addr}-->代理验证失败")
def encryptParamsId(login_subject_uid, user_identity_id): def encryptParamsId(login_subject_uid, user_identity_id):
e = { 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