nadzoring.network_base.ping_address module¶
ICMP ping utility using the ping3 library.
- nadzoring.network_base.ping_address._normalize_address(addr: str) str[source]¶
Normalise a raw address or URL into a bare hostname / IP string.
Strips
http://andhttps://scheme prefixes and removes any leadingwww.subdomain so thatping3receives a plain hostname.- Parameters:
addr – Raw address, URL, or hostname to normalise.
- Returns:
Bare hostname or IP address string.
- nadzoring.network_base.ping_address.ping_addr(addr: str) bool[source]¶
Check reachability of an IP address or hostname using ICMP ping.
Normalises URLs before pinging so that values like
https://example.comare handled transparently.Note
Some hosts block ICMP requests and will always return
Falseregardless of their actual availability.- Parameters:
addr – IP address, hostname, or URL to ping.
- Returns:
Trueif the host replied within the default timeout,Falseotherwise (unreachable, blocked, or error).