class genvid.toolbox.NetworkTool(**kwargs)

Bases: BaseTool

Platform abstraction of network utilities.

NAME = 'network'

The name of the logger for this tool. Must be redefined in children.


IPv4 Family

AF_INET6 = 23

IPv6 Family

MAC Address Family

static get_network_interfaces()

Return the list of network interfaces on the system.

static get_network_addresses(interface, family)

Return the list of addresses for this interface.


interface: The name of the interface.

family: The family type of the addresses.


Return the local IP address.


URL to use for checking the IP address with get_external_ip() . For future compatiblity, the URL should return a bare string containing the external visible IP of the caller’s host.

New in version 1.15.0.


Return the external IP of the current machine.

It uses CHECKIP_URL for the default server.

Changed in version 1.15.0: Use the CHECKIP_URL to fetch the IP.

Changed in version 1.19.0: Remove the support for ipgetter package and make it a normal method. Also, use GENVID_CHECKIP_URL instead, for more flexibility.


A mirror of GENVID_DEFAULT_IP. It specifies the IP address to use for the local services. Defaults to


A mirror of GENVID_CHECKIP_URL. It specifies the url to fetch to retrieve the external IP address of the machine. The default is specified through the CHECKIP_URL.

New in version 1.19.0.

get_interface_from_ip(ip, family=AddressFamily.AF_INET)

Try to find the the IPInterface containing the specified IP address.

get_network_interface(ip, family=AddressFamily.AF_INET)

Return the network interface associated with an IP address.


ip: The IP address to match.

family: The family of the IP address. Defaults to AF_INET (IPv4).


Return the list of nameservers configured in /etc/resolv.conf.


Return the list of nameservers configured on a Windows system.


Return the list of nameservers on the system.

urlretrieve_report(url, size, total)

Default urlretrieve() log function.

urlretrieve(url: str, filename: Optional[Union[Path, str]] = None) Path

Download a URL.

Progress is shown using urlretrieve_report().

  • url – The URL to retrieve.

  • filename – The destination file. If None, it uses a temporary file.


The Path of the downloaded file.

class network.NetworkTool

Implementation of genvid.toolbox.NetworkTool