get_by_method

getmac.getmac.get_by_method(method_type, arg='', network_request=True)[source]

Query for a MAC using a specific method.

Parameters:
  • method_type (str) – the type of lookup being performed. Allowed values are: ip4, ip6, iface, default_iface

  • arg (str) – Argument to pass to the method, e.g. an interface name or IP address

  • network_request (bool) – if methods that make network requests should be included (those methods that have the attribute network_request set to True)

Return type:

Optional[str]

Returns:

The MAC address string, or None if the operation failed