pingparsing

raw JSON →
1.4.2 verified Mon Apr 27 auth: no python

pingparsing is a CLI tool and Python library for parsing and transmitting ping command output. Current version 1.4.2 requires Python >=3.7. It parses ICMP reply statistics, supports multiple platforms (Linux, macOS, Windows), and provides ping transmission and result serialization. Release cadence is irregular, with minor updates every few months.

pip install pingparsing
error ModuleNotFoundError: No module named 'pingparsing'
cause Library not installed or installed in a different environment.
fix
Run pip install pingparsing in the correct Python environment.
error AttributeError: 'PingParsing' object has no attribute 'parse'
cause Using outdated import or method name.
fix
Use PingParsing().parse(result) (the method is parse, not parse_output).
error pingparsing.errors.PingError: ping command not found
cause System does not have `ping` command in PATH.
fix
Ensure ping is installed and accessible (e.g., install iputils-ping on Linux).
gotcha The library parses the output of the system `ping` command, which varies by OS/version. Parsing may fail on uncommon ping implementations (e.g., BusyBox, embedded systems).
fix Test on target platforms; use `PingTransmitter` with `ping_option='-O'` on Linux for timestamp support.
breaking In v1.4.0, support for pyparsing v2 was dropped. Code using pyparsing v2 API directly will break.
fix Update pyparsing to v3.x or pin pingparsing to <1.4.0.
deprecated Python 3.6 support was dropped in v1.4.2. Users on Python 3.6 must stay on older versions.
fix Upgrade Python to 3.7+.
gotcha The library requires root/admin privileges to set ping options like `--interval` or `--timeout` on some systems (e.g., Linux).
fix Run the script with appropriate privileges or use default options.

Transmit pings and parse the output into a dictionary.

import os
from pingparsing import PingTransmitter, PingParsing

transmitter = PingTransmitter()
transmitter.destination = os.environ.get('PING_DEST', '8.8.8.8')
transmitter.count = 3
result = transmitter.ping()

parser = PingParsing()
parser.parse(result)
stats = parser.as_dict()
print(stats)