From 760fad82af1ea3953f398d5cdff715cc45962cd3 Mon Sep 17 00:00:00 2001 From: JrD <421273918@qq.com> Date: Fri, 18 Sep 2020 12:09:02 +0800 Subject: [PATCH] debug --- common/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils.py b/common/utils.py index 7a1957b..f5620cd 100644 --- a/common/utils.py +++ b/common/utils.py @@ -748,7 +748,7 @@ def ping_avg_time(nameserver): logger.log('ALERT', f'100.0% packet loss, ping {nameserver} failed.') return None elif platform.system() in ('Darwin', 'Linux'): - avg_time = re.findall(r'\d+\.\d+', f.readlines()[-1])[1] + avg_time = re.findall(r'(?:min/avg/max/.+ )(?:\d+\.\d+)/(\d+\.\d+)/', text)[0] logger.log('INFOR', f'ping {nameserver} average time {avg_time} ms.') return avg_time elif platform.system() == 'Windows':