🔔 Welcome to yaping¶
Yet another python library for pinging multiple hosts.
It focuses on providing both sync and asynch versions and minimizing the amount of of OS resources (only a single socket is used for handling multiple hosts with multiple ping requests)
Without further ado:
python -m asyncio
from yaping.ping import aioping
from yaping.tools import response_text
async for response in ping(["gnu.org", "orcid.org"], count=4, interval=0.5, strict_interval=True):
text = response_text(response)
print(text)
64 bytes from orcid.org (104.20.228.70): icmp_seq=1 time=4.8ms
64 bytes from gnu.org (209.51.188.116): icmp_seq=1 time=113.4ms
64 bytes from orcid.org (104.20.228.70): icmp_seq=2 time=4.7ms
64 bytes from gnu.org (209.51.188.116): icmp_seq=2 time=118.8ms
64 bytes from orcid.org (104.20.228.70): icmp_seq=3 time=5.6ms
64 bytes from gnu.org (209.51.188.116): icmp_seq=3 time=127.0ms
64 bytes from orcid.org (104.20.228.70): icmp_seq=4 time=4.4ms
64 bytes from gnu.org (209.51.188.116): icmp_seq=4 time=112.5ms
Sync works great too:
$ python
>>> from yaping.ping import ping
>>> from yaping.tools import response_text
>>> for response in ping(["gnu.org", "orcid.org"], count=2):
... text = response_text(response)
... print(text)
64 bytes from orcid.org (104.20.228.70): icmp_seq=1 time=4.8ms
64 bytes from gnu.org (209.51.188.116): icmp_seq=1 time=113.4ms
64 bytes from orcid.org (104.20.228.70): icmp_seq=2 time=4.7ms
64 bytes from gnu.org (209.51.188.116): icmp_seq=2 time=118.8ms
>>>
Requirements:
- python >= 3.9
Installation¶
From within your favorite python environment:
pip install yaping
pip install yaping
To develop, run tests, build package, lint, etc you'll need:
$ pip install yaping[dev]
To run docs you'll need:
$ pip install yaping[docs]