def mac(self, interface_name):
"""
interface: str , Interface Name
return: List
[{'addr': '00:12:34:56:78:9a'}]
"""
interface_check = self.interfaces
if not interface_name in interface_check:
raise WrongInterfaceName("Wrong Interface Name %s" % interface_name)
addrs = netifaces.ifaddresses(interface_name)
return addrs[netifaces.AF_LINK]
评论列表
文章目录