GithubHelp home page GithubHelp logo

blakme / debinterface Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dggreenbaum/debinterface

0.0 2.0 0.0 69 KB

A simple Python library for dealing with the /etc/network/interfaces file in most Debian based distributions.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

debinterface's Introduction

#Debinterface

This is a simple Python library for dealing with the /etc/network/interfaces file in most Debian based distributions.

Changelog:

2.0-beta - September 2014 : refactoring which breaks retrocompatibility 1.0 - Dec 15 2012

Read, writing, and editing supported.

Specify file locations in constants.py

May thanks to yan12125 (https://github.com/yan12125/debinterface)

Example usage:

import debinterface

# 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:
for adapter in adapters:
	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()

debinterface's People

Contributors

dggreenbaum avatar glennlugod avatar nmustaki avatar skyph avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.