silence error???

This commit is contained in:
Cyberes 2023-04-21 23:54:20 -06:00
parent 08c06777d6
commit dfc77a2f4d
1 changed files with 11 additions and 1 deletions

View File

@ -2,6 +2,7 @@
import argparse
import sys
import traceback
import warnings
from cloudflarepycli import cloudflareclass
@ -22,6 +23,15 @@ def main():
parser.add_argument('--critical-latency', type=int, default=100, help='Critical level of latency in ms.')
args = parser.parse_args()
# Silence this error:
"""
lib/python3.10/site-packages/numpy/core/fromnumeric.py:3464: RuntimeWarning: Mean of empty slice.
return _methods._mean(a, axis=axis, dtype=dtype,
lib/python3.10/site-packages/numpy/core/_methods.py:192: RuntimeWarning: invalid value encountered in scalar divide
ret = ret.dtype.type(ret / rcount)
"""
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=RuntimeWarning)
speedtest_results = cloudflareclass.cloudflare(printit=False).runalltests()
out_str = f"upload: {speedtest_results['90th_percentile_upload_speed']['value']} Mbps, download: {speedtest_results['90th_percentile_download_speed']['value']} Mbps, latency: {speedtest_results['latency_ms']['value']} ms, Jitter: {speedtest_results['Jitter_ms']['value']} ms"