查看和控制网络接口。目前只有Linux!加入我们,让它可用于其他操作系统
pyiface的Python项目详细描述
一般信息
pyiface是一个公开操作的网络接口的包 系统使用方便、透明。典型用法如下:
#!/usr/bin/env pythonimportpyifacefrompyiface.ifreqioctlsimportIFF_UP# Get all available network interfacesallIfaces=pyiface.getIfaces()forifaceinallIfaces:print(iface)# Get a specific interface by nameeth0=pyiface.Interface(name='eth0')# view eth0 infoprint(eth0)# bring eth0 upeth0.flags=eth0.flags|IFF_UP# set ipv4 address of the interfaceeth0.addr=(socket.AF_INET,'1.2.3.4')# set ipv6 address of the interfaceeth0.addr=(socket.AF_INET6,'2001:0db8:85a3:0000:0000:8a2e:0370:7334')
安装
要安装软件包,只需使用install选项调用setup.py。