一个简单的python库,用于处理大多数基于debian的发行版中的/etc/network/interfaces文件。

debinterface的Python项目详细描述


https://travis-ci.org/nMustaki/debinterface.svg?branch=master

这是一个简单的python库,用于处理大多数基于debian的发行版中的/etc/network/interfaces文件。 它是从https://github.com/dggreenbaum/debinterface派生来重构它的,并可能使用wpa恳求处理扩展它

完整的文档位于Read the docs

示例用法

你会找到方法more examples here

importdebinterface# Get a collection of objects representing the network adapters.adapters=debinterface.Interfaces().adapters# You get a list you can iterare over.# Each adapter has an 'export()' method that returns a dictionary of its options.# You can print the name of each adapter as follows:foradapterinadapters:item=adapter.export()print(item['name'])# Write your new interfaces file as follows:# Any changes made with setter methods will be reflected with the new write.interfaces=debinterface.Interfaces()interfaces.writeInterfaces()# A backup of your old interfaces file will be generated when writing over the previous interfaces file# By defaults these paths are used :# INTERFACES_PATH='/etc/network/interfaces'# BACKUP_PATH='/etc/network/interfaces.old'# Paths can be customized when instanciating the Interfaces class:interfaces=debinterface.Interfaces(interfaces_path='/home/interfaces',backup_path='/another/custom/path')# By defaults, interfaces file is read when instanciating the Interfaces class, to do it lazyly:interfaces=debinterface.Interfaces(update_adapters=False)interfaces.updateAdapters()

运行测试

pip install -r requirements_dev.txt
py.test --cov=debinterface test

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
实现接口方法时不允许java@Override   使用BuffereImage加载映像时java高ram使用率   java For循环混乱,为什么不是循环?   java Android网格视图字符串对齐问题   java如何将方法与比较类型的附加功能进行比较?   在Java Swing中放置JSepator后的间隙大小   java如何避免并发访问我的网站中的支付链接   java如何从现有的Unix服务器连接到FTP服务器?   Spring中的java用户相关bean定义   带有scribesjava库的wordpress Woocommerce REST API返回消费者密钥参数缺失错误消息   java我可以自动检测特定设备连接的串行端口吗?   Javafx棋盘游戏   java使用JTextPane显示HTML,支持SVG吗?   SpringBoot如何在java中将映射转换为实体对象?   如何使用java代码对xls文件进行密码保护   Java JPA(EclipseLink)如何在持久化实际实体之前接收下一个生成的值?   Javaservlet启动外部进程