Python library: ping3

python3 version of ICMP ping implementation using raw socket.

Table of Contents

11 Nov 2022

Library resources
PyPI https://pypi.org/project/ping3/
Github https://github.com/kyan001/ping3
Documentation ---

Used as part of Pingee project Pingee

Getting Started

pip3 install ping3

Usage

from ping3 import ping, verbose_ping

hostnames = [
'208.67.222.222', # OpenDNS
'208.67.220.220', # OpenDNS  
'1.1.1.1', # Cloudflare
'1.0.0.1', # Cloudflare
'8.8.8.8', # Google DNS
'8.8.4.4', # Google DNS
]

for host in hostnames:
    p = ping(host)
    p_format = round(p*1000, 2)
    print(f"{host}: {p_format}ms")

links

social