utils.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:esdc-ce 作者: erigones 项目源码 文件源码
def get_local_netinfo(iface=None):
    if not iface:
        try:
            iface = netifaces.gateways()['default'][netifaces.AF_INET][1]
        except (KeyError, IndexError):
            raise OSError('Main network interface was not found')

    if iface not in netifaces.interfaces():
        raise ValueError('Network interface "%s" is not available on this system' % iface)

    try:
        return _get_local_netinfo(iface)
    except (KeyError, IndexError):
        raise OSError('Network information for interface "%s" is not available' % iface)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号