IPv4Address.is_private
IPv4Address.is_private is a Python method in the IP Address Module category. Returns True if the address is in a private IP range. The syntax is IPv4Address.is_private. Returns: Boolean. A typical example: ipaddress.ip_address("10.0.0.1").is_private # True
ipaddress.ip_address("8.8.8.8").is_private # False. A close sibling is ipaddress.ip_address(), which creates an IPv4Address or IPv6Address object from a string. A close sibling is ipaddress.ip_network(), which creates an IPv4Network or IPv6Network object from an IP network string. A close sibling is ipaddress.ip_interface(), which creates an IPv4Interface or IPv6Interface (host with network). A close sibling is IPv4Address.is_loopback, which returns True if the address is a loopback address (127.0.0.0/8). More about this category: IP address handling — IPv4Address, IPv6Address, IPv4Network, IPv6Network. Related IP Address Module entries: ipaddress.ip_address(), ipaddress.ip_network(), ipaddress.ip_interface(), IPv4Address.is_loopback, IPv4Address.is_multicast, IPv4Address.is_global. This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.