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:// and https:// scheme prefixes and removes any leading www. subdomain so that ping3 receives 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.com are handled transparently.

Note

Some hosts block ICMP requests and will always return False regardless of their actual availability.

Parameters:

addr – IP address, hostname, or URL to ping.

Returns:

True if the host replied within the default timeout, False otherwise (unreachable, blocked, or error).