source/projects/aloe/src/python/ping.py
Reid 'arrdem' McKenzie 8469ab7758 WIP on Aloe
2021-11-20 14:39:14 -07:00

18 lines
525 B
Python

"""A shitty ping wrapper."""
from datetime import timedelta
from subprocess import check_call, DEVNULL
def ping(host: str,
count: int = 3,
interval: float = 0.3,
timeout: timedelta = timedelta(seconds=3)):
return check_call(["ping", "-q",
"-i", str(interval),
"-c", str(count),
"-W", str(timeout.total_seconds()),
host],
stdout=DEVNULL,
stderr=DEVNULL,)