initialize_method_cache

getmac.getmac.initialize_method_cache(method_type, network_request=True)[source]

Initialize the method cache for the given method type.

Parameters:
  • method_type (str) – method type to initialize the cache for. Allowed values are: ip4 | ip6 | iface | default_iface

  • 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:

bool

Returns:

If the cache was initialized successfully

Raises:

RuntimeError – if no valid methods were found for the given method type and the system’s platform (or user-defined override platform), or if all matching methods failed to test.