Skip to main content
https://travis-ci.org/nMustaki/debinterface.svg?branch=master

This is a simple Python library for dealing with the /etc/network/interfaces file in most Debian based distributions. This is forked from https://github.com/dggreenbaum/debinterface to refactor it and maybe extends it with wpa_supplicant handling

Complete documentation is on Read the docs

Example usage

You’ll find way more examples here

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()

Run the tests

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

debinterface-3.4.0.tar.gz (440.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

debinterface-3.4.0-py2-none-any.whl (19.4 kB view details)

Uploaded Python 2

File details

Details for the file debinterface-3.4.0.tar.gz.

File metadata

  • Download URL: debinterface-3.4.0.tar.gz
  • Upload date:
  • Size: 440.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for debinterface-3.4.0.tar.gz
Algorithm Hash digest
SHA256 1b7f9f568d69006b34fea3315bde1fab6aa50faba67219f3dc5f8d9f6f7adaa7
MD5 7c06850d5e27124523b0d5a3622ff92b
BLAKE2b-256 ec12ddfd28453418cca2e4a3d6aff89851c2142af68acce3ca7fe33523c05428

See more details on using hashes here.

File details

Details for the file debinterface-3.4.0-py2-none-any.whl.

File metadata

File hashes

Hashes for debinterface-3.4.0-py2-none-any.whl
Algorithm Hash digest
SHA256 2a109b4eb0538f41a419582a850e8a4344da25324159644681d2c7c167716527
MD5 1c761a49df85452ec81509ecdc647a91
BLAKE2b-256 ca3b2ec80350a49c4aee069f72ece19836d31f07cf0a51eef6fe20149912823b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page