Skip to main content

ping in python

Project description

PyPI Coverage GitHub license


ping in python


pip install pping


from pping import ping
result = ping('') # simple usage
result = ping('', # optional arguments
              repeat=4,          # -- Number of echo requests to send.
              interval=1,        # -- Time in seconds interval between each request.
              size=32,           # -- Send buffer size in bytes.
              timeout=1,         # -- Timeout in seconds to wait for each reply.
              ttl=128)           # -- Time To Live.

Operation on the result

>>> print(result)
Reply from bytes=32 time=151ms TTL=52
Request timed out.
Reply from bytes=32 time=149ms TTL=52
Reply from bytes=32 time=150ms TTL=52

Ping statistics for
        Packets: Sent = 4, Received = 3, Lost = 1 (25% loss)
Approximate round trip times in milli-seconds:
        Average = 150ms, Minimum = 149ms, Maximum = 151ms, Stdev = 0.5
>>> result[0]
Response(status='ok', src='', dst='', ttl=52, size=32, seq=1, rtt=0.15059328079223633)

>>> result[1]
>>> result.hostname

>>> result.iplist
>>> result.times      # timed out are not inclued
[0.15059328079223633, 0.1492629051208496, 0.14995193481445312]

>>> result.all_times  # timed out as None
[0.15059328079223633, None, 0.1492629051208496, 0.14995193481445312]
# other properties
>>> result.hostalias
>>> result.avg
>>> result.min
>>> result.max
>>> result.stdev
>>> result.sent
>>> result.recv
>>> result.lost


This project is licensed under the MIT License - see the LICENSE file for details

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pping, version 0.0.9
Filename, size File type Python version Upload date Hashes
Filename, size pping-0.0.9-py3-none-any.whl (7.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pping-0.0.9.tar.gz (6.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page