一个简单的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 Cassandra复制因子大于节点数   java J2EE JTA事务回滚不适用于OSE Glassfish 4.0(Build 89)   java spring安全预认证用户登录   org的java类文件。反应流。从RxJava编译示例时未找到Publisher?   java在使用dataFormat作为POJO通过Camel调用Web服务时无法设置SOAP标头   Javafx类的java静态实例   java如何防止一个部件在关闭时覆盖另一个部件的位置   sql server无法从我的java代码连接到数据库   java在JList(Swing)中显示带有的ArrayList   从Java中的CXF服务获取WSAddressing数据   使用资产文件夹进行java简单json解析(本地)   java LDAPException未绑定的无效凭据   JavaJSFspring部署到weblogic   JAVA中字符数组中的特定元素排列?   如果脚本位于不同的目录中,则ant不会使用exec标记运行Javashell脚本